w32: Fix another memleak on error.

* src/w32-io.c (create_reader): free CTX.
--

Found by Hans-Christoph Steiner with cppcheck.
This commit is contained in:
Werner Koch 2014-04-15 16:40:48 +02:00
parent 85a07ca7e3
commit 62711e5614
2 changed files with 5 additions and 0 deletions

View File

@ -901,6 +901,10 @@ build_argv (engine_gpg_t gpg, const char *pgmname)
close_notify_handler, close_notify_handler,
gpg)) 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); return gpg_error (GPG_ERR_GENERAL);
} }
/* If the data_type is FD, we have to do a dup2 here. */ /* If the data_type is FD, we have to do a dup2 here. */

View File

@ -425,6 +425,7 @@ create_reader (int fd)
if (fd < 0 || fd >= MAX_SLAFD || !fd_table[fd].used) if (fd < 0 || fd >= MAX_SLAFD || !fd_table[fd].used)
{ {
TRACE_SYSERR (EIO); TRACE_SYSERR (EIO);
free (ctx);
return NULL; return NULL;
} }
TRACE_LOG4 ("fd=%d -> handle=%p socket=%d dupfrom=%d", TRACE_LOG4 ("fd=%d -> handle=%p socket=%d dupfrom=%d",