aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2014-04-15 14:40:48 +0000
committerWerner Koch <[email protected]>2014-07-30 09:13:15 +0000
commit27f052b9df75c3703d3ceabab2d2615e46665fe1 (patch)
tree3fa2c869796312840ad3fc6459168b41be31fc55
parentFix possible zombie processes. (diff)
downloadgpgme-27f052b9df75c3703d3ceabab2d2615e46665fe1.tar.gz
gpgme-27f052b9df75c3703d3ceabab2d2615e46665fe1.zip
w32: Fix memleak in an error code paths.
* src/w32-io.c (create_writer): Free CTX in cased of bad FD. * src/w32-util.c (_gpgme_mkstemp): Free TMPNAME in case of a failed mkstemp. -- Found by Hans-Christoph Steiner with cppcheck.
-rw-r--r--src/w32-io.c1
-rw-r--r--src/w32-util.c5
2 files changed, 5 insertions, 1 deletions
diff --git a/src/w32-io.c b/src/w32-io.c
index d896ec0e..133d29e1 100644
--- a/src/w32-io.c
+++ b/src/w32-io.c
@@ -794,6 +794,7 @@ create_writer (int fd)
if (fd < 0 || fd >= MAX_SLAFD || !fd_table[fd].used)
{
TRACE_SYSERR (EIO);
+ free (ctx);
return NULL;
}
TRACE_LOG4 ("fd=%d -> handle=%p socket=%d dupfrom=%d",
diff --git a/src/w32-util.c b/src/w32-util.c
index 4cee1cb6..2dc76557 100644
--- a/src/w32-util.c
+++ b/src/w32-util.c
@@ -660,7 +660,10 @@ _gpgme_mkstemp (int *fd, char **name)
strcpy (stpcpy (tmpname, tmp), "\\gpgme-XXXXXX");
*fd = mkstemp (tmpname);
if (fd < 0)
- return -1;
+ {
+ free (tmpname);
+ return -1;
+ }
*name = tmpname;
return 0;