From 7a1b58045f980c4df76daf225a2a1b604e8604d2 Mon Sep 17 00:00:00 2001 From: Andre Heinecke Date: Mon, 29 Oct 2018 19:44:02 +0100 Subject: [PATCH] core,w32: Fix memleak of tmp_name in w32-io * src/w32-io.c (_gpgme_io_spawn): Free tmp_name. -- GnuPG-Bug-Id: T4238 --- src/w32-io.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/w32-io.c b/src/w32-io.c index 05e11ee8..d3b1b91f 100644 --- a/src/w32-io.c +++ b/src/w32-io.c @@ -1610,6 +1610,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, { close (tmp_fd); DeleteFileA (tmp_name); + free (tmp_name); return TRACE_SYSRES (-1); } @@ -1649,6 +1650,9 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, MessageBoxA (NULL, msg, "GpgME not installed correctly", MB_OK); gpgrt_free (msg); gpg_err_set_errno (EIO); + close (tmp_fd); + DeleteFileA (tmp_name); + free (tmp_name); return TRACE_SYSRES (-1); } if (!CreateProcessA (spawnhelper, @@ -1667,12 +1671,14 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, free (arg_string); close (tmp_fd); DeleteFileA (tmp_name); + free (tmp_name); /* FIXME: Should translate the error code. */ gpg_err_set_errno (EIO); return TRACE_SYSRES (-1); } + free (tmp_name); free (arg_string); if (flags & IOSPAWN_FLAG_ALLOW_SET_FG) @@ -1702,6 +1708,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, close (tmp_fd); DeleteFileA (tmp_name); + free (tmp_name); /* FIXME: Should translate the error code. */ gpg_err_set_errno (EIO);