From 2114ef18742142a7eb1df367558967a754be8059 Mon Sep 17 00:00:00 2001
From: Allan McRae <allan@archlinux.org>
Date: Wed, 24 Dec 2014 10:54:28 +1000
Subject: conflict_new: free memory on error

Signed-off-by: Allan McRae <allan@archlinux.org>
---
 lib/libalpm/conflict.c | 8 ++++++--
 1 file 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;
 }
 
 /**
-- 
cgit v1.2.3-70-g09d2