Skip to content

Commit 44527f5

Browse files
committed
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.
1 parent 524c1d3 commit 44527f5

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/proxy.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,9 @@ int git_proxy_options_dup(git_proxy_options *tgt, const git_proxy_options *src)
3131

3232
return 0;
3333
}
34+
35+
void git_proxy_options_free(git_proxy_options *opts)
36+
{
37+
git__free((char *) opts->url);
38+
opts->url = NULL;
39+
}

src/proxy.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
#include "git2/proxy.h"
1313

1414
extern int git_proxy_options_dup(git_proxy_options *tgt, const git_proxy_options *src);
15+
extern void git_proxy_options_free(git_proxy_options *opts);
1516

1617
#endif

0 commit comments

Comments
 (0)