Commit e29ab6feb3fad4bcfe0edeff5bde98b860033deb

Carlos Martín Nieto 2017-09-27T15:17:26

proxy: add a free function for the options's pointers When we duplicate a user-provided options struct, we're stuck with freeing the url in it. In case we add stuff to the proxy struct, let's add a function in which to put the logic.

diff --git a/src/proxy.c b/src/proxy.c
index f53ac11..35855e9 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -30,3 +30,9 @@ int git_proxy_options_dup(git_proxy_options *tgt, const git_proxy_options *src)
 
 	return 0;
 }
+
+void git_proxy_options_free(git_proxy_options *opts)
+{
+	git__free((char *) opts->url);
+	opts->url = NULL;
+}
diff --git a/src/proxy.h b/src/proxy.h
index bf93827..7d35a20 100644
--- a/src/proxy.h
+++ b/src/proxy.h
@@ -10,5 +10,6 @@
 #include "git2/proxy.h"
 
 extern int git_proxy_options_dup(git_proxy_options *tgt, const git_proxy_options *src);
+extern void git_proxy_options_free(git_proxy_options *opts);
 
 #endif
\ No newline at end of file