(read_passphrase_from_fd): Fixed memory leak.
authorWerner Koch <wk@gnupg.org>
Mon, 13 Dec 2004 08:04:52 +0000 (08:04 +0000)
committerWerner Koch <wk@gnupg.org>
Mon, 13 Dec 2004 08:04:52 +0000 (08:04 +0000)
Noted by Andrei Darashenka.

g10/ChangeLog
g10/passphrase.c

index 9a30073..4f7620b 100644 (file)
@@ -1,3 +1,8 @@
+2004-12-13  Werner Koch  <wk@g10code.com>
+
+       * passphrase.c (read_passphrase_from_fd): Fixed memory leak.
+       Noted by Andrei Darashenka.
+
 2004-12-11  David Shaw  <dshaw@jabberwocky.com>
 
        * keyserver.c (parse_preferred_keyserver): Force preferred
 2004-12-11  David Shaw  <dshaw@jabberwocky.com>
 
        * keyserver.c (parse_preferred_keyserver): Force preferred
index 3b14918..9d303f4 100644 (file)
@@ -173,7 +173,10 @@ read_passphrase_from_fd( int fd )
           len += 100;
           pw = m_alloc_secure( len );
           if( pw2 )
           len += 100;
           pw = m_alloc_secure( len );
           if( pw2 )
-            memcpy(pw, pw2, i );
+            {
+              memcpy(pw, pw2, i );
+              m_free (pw2);
+            }
           else
             i=0;
        }
           else
             i=0;
        }