From 0efb59a9793d8788ff587933427787c0b035fd6a Mon Sep 17 00:00:00 2001
From: Duncaen <mail@duncano.de>
Date: Mon, 17 Jun 2019 18:21:10 +0200
Subject: [PATCH] lib/transaction_files.c: fix undefined behaviour

---
 lib/transaction_files.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/transaction_files.c b/lib/transaction_files.c
index 78323fd9..1724c5ad 100644
--- a/lib/transaction_files.c
+++ b/lib/transaction_files.c
@@ -365,7 +365,6 @@ collect_file(struct xbps_handle *xhp, const char *file, size_t size,
 			return ENOMEM;
 		item->deleted = false;
 		goto add;
-		return 0;
 	}
 
 	if (remove) {
@@ -656,7 +655,6 @@ xbps_transaction_files(struct xbps_handle *xhp, xbps_object_iterator_t iter)
 	xbps_dictionary_t pkgd, filesd;
 	xbps_object_t obj;
 	const char *trans, *pkgver;
-	bool preserve;
 	int rv = 0;
 	unsigned int idx = 0;
 
@@ -710,6 +708,7 @@ xbps_transaction_files(struct xbps_handle *xhp, xbps_object_iterator_t iter)
 		pkgd = xbps_pkgdb_get_pkg(xhp, pkgname);
 		if (pkgd) {
 			const char *oldpkgver;
+			bool preserve = false;
 			xbps_dictionary_get_cstring_nocopy(pkgd, "pkgver", &oldpkgver);
 			xbps_dictionary_get_bool(obj, "preserve", &preserve);
 			/*