[pacman-dev] [PATCH] Fix memory leak in alpm_pkg_checkmd5sum

Allan McRae allan at archlinux.org
Wed Jan 4 05:25:59 UTC 2017


Also remove redundant additional return path.

Signed-off-by: Allan McRae <allan at archlinux.org>
---
 lib/libalpm/package.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index d0f902f0..e9ecc178 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -69,9 +69,9 @@ int SYMEXPORT alpm_pkg_checkmd5sum(alpm_pkg_t *pkg)
 
 	retval = _alpm_test_checksum(fpath, pkg->md5sum, ALPM_PKG_VALIDATION_MD5SUM);
 
-	if(retval == 0) {
-		return 0;
-	} else if(retval == 1) {
+	FREE(fpath);
+
+	if(retval == 1) {
 		pkg->handle->pm_errno = ALPM_ERR_PKG_INVALID;
 		retval = -1;
 	}
-- 
2.11.0


More information about the pacman-dev mailing list