[Pkg-gnupg-commit] [gnupg2] 19/34: gpg: Fix memory leak in parse_auto_key_locate.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Fri Aug 11 16:51:22 UTC 2017


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

dkg pushed a commit to branch upstream
in repository gnupg2.

commit b70e86fd1050fc6da07a177ed142ae9882b4dd0d
Author: Werner Koch <wk at gnupg.org>
Date:   Fri Aug 4 22:46:40 2017 +0200

    gpg: Fix memory leak in parse_auto_key_locate.
    
    * g10/getkey.c (parse_auto_key_locate): Fix freeing of OPTIONS.
    --
    
    It was probably too late for me to hack.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>
---
 g10/getkey.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/g10/getkey.c b/g10/getkey.c
index 5b7aff9..852c532 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -4232,8 +4232,9 @@ int
 parse_auto_key_locate (const char *options_arg)
 {
   char *tok;
-  char *options = xstrdup (options_arg);
+  char *options, *options_buf;
 
+  options = options_buf = xstrdup (options_arg);
   while ((tok = optsep (&options)))
     {
       struct akl *akl, *check, *last = NULL;
@@ -4272,7 +4273,7 @@ parse_auto_key_locate (const char *options_arg)
       else
 	{
 	  free_akl (akl);
-          xfree (options);
+          xfree (options_buf);
 	  return 0;
 	}
 
@@ -4301,7 +4302,7 @@ parse_auto_key_locate (const char *options_arg)
 	}
     }
 
-  xfree (options);
+  xfree (options_buf);
   return 1;
 }
 

-- 
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