Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/backup.c
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@stoeckmann.org>2016-06-06 20:12:30 +0200
committerAndrew Gregory <andrew.gregory.8@gmail.com>2017-05-08 23:27:41 -0400
commit8abb0cbf0e76bc9e59aa58b368ca11a2f0c189f2 (patch)
tree29bed21bbaba10aeac3f34a54aea0e2e672e25dd /lib/libalpm/backup.c
parente03c5392883a39be1bf46a4d5811d2c46359d196 (diff)
Release resources on error paths.
Some resources (memory or file descriptors) are not released on all error paths. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org> Signed-off-by: Allan McRae <allan@archlinux.org> (cherry picked from commit 681509fd445ed6012e6ecf89b49e9c00d83b70cd)
Diffstat (limited to 'lib/libalpm/backup.c')
-rw-r--r--lib/libalpm/backup.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libalpm/backup.c b/lib/libalpm/backup.c
index f6225898..50bad5e6 100644
--- a/lib/libalpm/backup.c
+++ b/lib/libalpm/backup.c
@@ -48,9 +48,10 @@ int _alpm_split_backup(const char *string, alpm_backup_t **backup)
ptr++;
/* now str points to the filename and ptr points to the hash */
STRDUP((*backup)->name, str, FREE(str); return -1);
- STRDUP((*backup)->hash, ptr, FREE(str); return -1);
+ STRDUP((*backup)->hash, ptr, FREE((*backup)->name); 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.