summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2014-12-24 10:54:28 +1000
committerAllan McRae <allan@archlinux.org>2014-12-24 11:19:30 +1000
commit2114ef18742142a7eb1df367558967a754be8059 (patch)
tree065f14d188023efb584c3fe55321e18119dddf04 /lib
parent9cf1b2c00432420499c0f1031d15ebccd23b2ae9 (diff)
downloadpacman-2114ef18742142a7eb1df367558967a754be8059.tar.xz
conflict_new: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib')
-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 6402ab3d..40cbb953 100644
--- a/lib/libalpm/conflict.c
+++ b/lib/libalpm/conflict.c
@@ -52,11 +52,15 @@ static alpm_conflict_t *conflict_new(alpm_pkg_t *pkg1, alpm_pkg_t *pkg2,
conflict->package1_hash = pkg1->name_hash;
conflict->package2_hash = pkg2->name_hash;
- STRDUP(conflict->package1, pkg1->name, return NULL);
- STRDUP(conflict->package2, pkg2->name, return NULL);
+ STRDUP(conflict->package1, pkg1->name, goto error);
+ STRDUP(conflict->package2, pkg2->name, goto error);
conflict->reason = reason;
return conflict;
+
+error:
+ alpm_conflict_free(conflict);
+ return NULL;
}
/**