[pacman-dev] [PATCH] extract_single_file: fix memory leak in error condition

Allan McRae allan at archlinux.org
Mon Nov 17 14:51:41 UTC 2014


The memory assigned to checkfile was leaked in the error condition.

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

diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index ee2b7ec..20f5139 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -317,7 +317,7 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
 			if(!backup->name || strcmp(backup->name, entryname_orig) != 0) {
 				continue;
 			}
-			STRDUP(newhash, hash_pkg, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
+			STRDUP(newhash, hash_pkg, errors++; handle->pm_errno = ALPM_ERR_MEMORY; goto needbackup_cleanup);
 			FREE(backup->hash);
 			backup->hash = newhash;
 		}
-- 
2.1.3


More information about the pacman-dev mailing list