8000 Set the pointer to null upon disposing · UiPath/libgit2sharp@b2d9e44 · GitHub
[go: up one dir, main page]

Skip to content

Commit b2d9e44

Browse files
committed
Set the pointer to null upon disposing
1 parent 86498c7 commit b2d9e44

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

LibGit2Sharp/Core/Handles/Objects.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ void Dispose(bool disposing)
5555
if (owned)
5656
{
5757
NativeMethods.git_tree_entry_free(ptr);
58+
ptr = null;
5859
}
5960
}
6061

@@ -123,6 +124,7 @@ void Dispose(bool disposing)
123124
if (owned)
124125
{
125126
NativeMethods.git_reference_free(ptr);
127+
ptr = null;
126128
}
127129
}
128130

@@ -191,6 +193,7 @@ void Dispose(bool disposing)
191193
if (owned)
192194
{
193195
NativeMethods.git_repository_free(ptr);
196+
ptr = null;
194197
}
195198
}
196199

LibGit2Sharp/Core/Handles/Objects.tt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ for (var i = 0; i < cNames.Length; i++)
7777
if (owned)
7878
{
7979
NativeMethods.<#= cNames[i] #>_free(ptr);
80+
ptr = null;
8081
}
8182
}
8283

0 commit comments

Comments
 (0)
0