From 0dad2f6e6223e2aa00c43b59f49bf83082a0d6bb Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Fri, 26 Aug 2011 13:10:38 +0200 Subject: [PATCH] lib/libalpm/util.c: Fix two memory leaks Free "md5sum" if md5_file() fails in alpm_compute_md5sum(). Free "sha256sum" if sha2_file() fails in alpm_compute_sha256sum(). Signed-off-by: Lukas Fleischer Signed-off-by: Dan McGee --- lib/libalpm/util.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index cf783893..98eaa175 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -836,6 +836,7 @@ char SYMEXPORT *alpm_compute_md5sum(const char *filename) ret = md5_file(filename, output); if(ret > 0) { + free(md5sum); return NULL; } @@ -867,6 +868,7 @@ char SYMEXPORT *alpm_compute_sha256sum(const char *filename) ret = sha2_file(filename, output, 0); if(ret > 0) { + free(sha256sum); return NULL; }