[Pkg-gnupg-commit] [gnupg2] 94/160: g10: Fix memory leak.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Fri Jul 15 09:36:40 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch upstream
in repository gnupg2.

commit 78aeb236fe4ff3a6d51b3095148e7086f2a6e9a8
Author: Justus Winter <justus at g10code.com>
Date:   Fri Jul 1 14:09:01 2016 +0200

    g10: Fix memory leak.
    
    * g10/keyserver.c (parse_keyserver_uri): Free URI.
    
    Signed-off-by: Justus Winter <justus at g10code.com>
---
 g10/keyserver.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/g10/keyserver.c b/g10/keyserver.c
index d7105de..2e2d6a4 100644
--- a/g10/keyserver.c
+++ b/g10/keyserver.c
@@ -240,13 +240,13 @@ parse_keyserver_uri (const char *string,int require_scheme)
   struct keyserver_spec *keyserver;
   const char *idx;
   int count;
-  char *uri,*options;
+  char *uri, *duped_uri, *options;
 
   log_assert (string);
 
   keyserver=xmalloc_clear(sizeof(struct keyserver_spec));
 
-  uri=xstrdup(string);
+  duped_uri = uri = xstrdup (string);
 
   options=strchr(uri,' ');
   if(options)
@@ -434,11 +434,13 @@ parse_keyserver_uri (const char *string,int require_scheme)
       goto fail;
     }
 
+  xfree (duped_uri);
   return keyserver;
 
  fail:
   free_keyserver_spec(keyserver);
 
+  xfree (duped_uri);
   return NULL;
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list