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.
This commit is contained in:
parent
1e488d3fd8
commit
27f052b9df
@ -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",
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user