summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2014-12-22 18:46:03 +1000
committerAllan McRae <allan@archlinux.org>2014-12-24 11:19:29 +1000
commit123ecb8e07a6489ceb2fc2e89f4ef62370aaf5bf (patch)
treef0c7798459ee2c03d082f67b34441911090a219e
parentc6dd581ec561af04e4e0edb07bcf74e4db17485a (diff)
downloadpacman-123ecb8e07a6489ceb2fc2e89f4ef62370aaf5bf.tar.xz
_alpm_split_backup: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r--lib/libalpm/backup.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/libalpm/backup.c b/lib/libalpm/backup.c
index aeb41316..1fc5eb79 100644
--- a/lib/libalpm/backup.c
+++ b/lib/libalpm/backup.c
@@ -47,11 +47,10 @@ int _alpm_split_backup(const char *string, alpm_backup_t **backup)
*ptr = '\0';
ptr++;
/* now str points to the filename and ptr points to the hash */
- STRDUP((*backup)->name, str, return -1);
- STRDUP((*backup)->hash, ptr, return -1);
+ STRDUP((*backup)->name, str, FREE(str); return -1);
+ STRDUP((*backup)->hash, ptr, FREE(str); return -1);
FREE(str);
- return 0;
-}
+ return 0;}
/* Look for a filename in a alpm_pkg_t.backup list. If we find it,
* then we return the full backup entry.