[pacman-dev] [PATCH 1/5] create_tempfile: fix memory leak on error

Allan McRae allan at archlinux.org
Wed Dec 24 01:01:37 UTC 2014


Signed-off-by: Allan McRae <allan at archlinux.org>
---
 lib/libalpm/dload.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index e3409f9..c5186be 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -379,7 +379,7 @@ static FILE *create_tempfile(struct dload_payload *payload, const char *localpat
 	payload->tempfile_name = randpath;
 	free(payload->remote_name);
 	STRDUP(payload->remote_name, strrchr(randpath, '/') + 1,
-			RET_ERR(payload->handle, ALPM_ERR_MEMORY, NULL));
+			fclose(fp); RET_ERR(payload->handle, ALPM_ERR_MEMORY, NULL));
 
 	return fp;
 }
-- 
2.2.1


More information about the pacman-dev mailing list