summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2014-12-22 08:39:47 +0100
committerAllan McRae <allan@archlinux.org>2014-12-24 02:19:29 +0100
commit27506aba8fe1e67bff7df47922d0e5fbba17b19f (patch)
tree4615b2f10d13d1541acfecd12da514da255a9928 /lib/libalpm
parent46459da39b4a38397f9781435573b7acd5b9004c (diff)
downloadpacman-27506aba8fe1e67bff7df47922d0e5fbba17b19f.tar.gz
pacman-27506aba8fe1e67bff7df47922d0e5fbba17b19f.tar.xz
_alpm_conflict_dup: fix memory leak on error
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/conflict.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
index db07102c..63b83048 100644
--- a/lib/libalpm/conflict.c
+++ b/lib/libalpm/conflict.c
@@ -79,11 +79,15 @@ alpm_conflict_t *_alpm_conflict_dup(const alpm_conflict_t *conflict)
newconflict->package1_hash = conflict->package1_hash;
newconflict->package2_hash = conflict->package2_hash;
- STRDUP(newconflict->package1, conflict->package1, return NULL);
- STRDUP(newconflict->package2, conflict->package2, return NULL);
+ STRDUP(newconflict->package1, conflict->package1, goto error);
+ STRDUP(newconflict->package2, conflict->package2, goto error);
newconflict->reason = conflict->reason;
return newconflict;
+
+error:
+ alpm_conflict_free(newconflict);
+ return NULL;
}
/**