From 681509fd445ed6012e6ecf89b49e9c00d83b70cd Mon Sep 17 00:00:00 2001 From: Tobias Stoeckmann Date: Mon, 6 Jun 2016 20:12:30 +0200 Subject: Release resources on error paths. Some resources (memory or file descriptors) are not released on all error paths. Signed-off-by: Tobias Stoeckmann Signed-off-by: Allan McRae --- lib/libalpm/backup.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/libalpm/backup.c') 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. -- cgit v1.2.3-24-g4f1b