[pacman-dev] [PATCH] parse_descfile: fix memory leak in error case

Allan McRae allan at archlinux.org
Tue Feb 24 10:59:46 UTC 2015


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

diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index 3e27232..e284254 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -237,7 +237,7 @@ static int parse_descfile(alpm_handle_t *handle, struct archive *a, alpm_pkg_t *
 			} else if(strcmp(key, "backup") == 0) {
 				alpm_backup_t *backup;
 				CALLOC(backup, 1, sizeof(alpm_backup_t), return -1);
-				STRDUP(backup->name, ptr, return -1);
+				STRDUP(backup->name, ptr, FREE(backup); return -1);
 				newpkg->backup = alpm_list_add(newpkg->backup, backup);
 			} else if(strcmp(key, "force") == 0) {
 				/* deprecated, skip it */
-- 
2.3.0


More information about the pacman-dev mailing list