1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

g10: Fix memory leak.

* g10/keyserver.c (parse_keyserver_uri): Free URI.

Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
Justus Winter 2016-07-01 14:09:01 +02:00
parent cff63da930
commit 78aeb236fe

View File

@ -240,13 +240,13 @@ parse_keyserver_uri (const char *string,int require_scheme)
struct keyserver_spec *keyserver; struct keyserver_spec *keyserver;
const char *idx; const char *idx;
int count; int count;
char *uri,*options; char *uri, *duped_uri, *options;
log_assert (string); log_assert (string);
keyserver=xmalloc_clear(sizeof(struct keyserver_spec)); keyserver=xmalloc_clear(sizeof(struct keyserver_spec));
uri=xstrdup(string); duped_uri = uri = xstrdup (string);
options=strchr(uri,' '); options=strchr(uri,' ');
if(options) if(options)
@ -434,11 +434,13 @@ parse_keyserver_uri (const char *string,int require_scheme)
goto fail; goto fail;
} }
xfree (duped_uri);
return keyserver; return keyserver;
fail: fail:
free_keyserver_spec(keyserver); free_keyserver_spec(keyserver);
xfree (duped_uri);
return NULL; return NULL;
} }