summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}
/**