diff options
author | Werner Koch <[email protected]> | 2014-04-15 14:40:48 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2014-04-16 08:19:54 +0000 |
commit | 62711e5614e44e65a7c7bb7d21493d09d3081271 (patch) | |
tree | 92e46fba3b843b56e7594d338e7d92b410953da8 | |
parent | w32: Fix memleak in an error code paths. (diff) | |
download | gpgme-62711e5614e44e65a7c7bb7d21493d09d3081271.tar.gz gpgme-62711e5614e44e65a7c7bb7d21493d09d3081271.zip |
w32: Fix another memleak on error.
* src/w32-io.c (create_reader): free CTX.
--
Found by Hans-Christoph Steiner with cppcheck.
-rw-r--r-- | src/engine-gpg.c | 4 | ||||
-rw-r--r-- | src/w32-io.c | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/engine-gpg.c b/src/engine-gpg.c index a8eab3a4..ce9e3494 100644 --- a/src/engine-gpg.c +++ b/src/engine-gpg.c @@ -901,6 +901,10 @@ build_argv (engine_gpg_t gpg, const char *pgmname) close_notify_handler, gpg)) { + /* We leak fd_data_map and the fds. This is not easy + to avoid and given that we reach this here only + after a malloc failure for a small object, it is + probably better not to do anything. */ return gpg_error (GPG_ERR_GENERAL); } /* If the data_type is FD, we have to do a dup2 here. */ diff --git a/src/w32-io.c b/src/w32-io.c index d00b8db3..42961e31 100644 --- a/src/w32-io.c +++ b/src/w32-io.c @@ -425,6 +425,7 @@ create_reader (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", |