Commit e93d0815 by yuangli

attempt to fix nego.shallowarray memory leak

parent 4536477e
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "git2/types.h" #include "git2/types.h"
#include "git2/oid.h" #include "git2/oid.h"
#include "git2/net.h" #include "git2/net.h"
#include "transports/smart.h"
#define CONFIG_URL_FMT "remote.%s.url" #define CONFIG_URL_FMT "remote.%s.url"
#define CONFIG_PUSHURL_FMT "remote.%s.pushurl" #define CONFIG_PUSHURL_FMT "remote.%s.pushurl"
...@@ -2163,6 +2164,8 @@ void git_remote_free(git_remote *remote) ...@@ -2163,6 +2164,8 @@ void git_remote_free(git_remote *remote)
free_heads(&remote->local_heads); free_heads(&remote->local_heads);
git_vector_free(&remote->local_heads); git_vector_free(&remote->local_heads);
git_shallowarray_free((remote->nego).shallow_roots);
git_push_free(remote->push); git_push_free(remote->push);
git__free(remote->url); git__free(remote->url);
git__free(remote->pushurl); git__free(remote->pushurl);
......
...@@ -510,3 +510,9 @@ int git_shallowarray_remove(git_shallowarray *array, git_oid *oid) ...@@ -510,3 +510,9 @@ int git_shallowarray_remove(git_shallowarray *array, git_oid *oid)
/* no git_array_remove… meh */ /* no git_array_remove… meh */
return -1; return -1;
} }
void git_shallowarray_free(git_shallowarray *array)
{
git_array_clear(array->array);
git__free(array);
}
...@@ -203,4 +203,6 @@ struct git_shallowarray { ...@@ -203,4 +203,6 @@ struct git_shallowarray {
git_array_oid_t array; git_array_oid_t array;
}; };
void git_shallowarray_free(git_shallowarray *array);
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment