From 54b72d8f81b457bad0e9956a462f8e63054d48af Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 5 Oct 2014 09:35:42 +0200 Subject: [PATCH] bin/xbps-rindex/index-add.c: fix CID 62685 correctly. --- bin/xbps-rindex/index-add.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/xbps-rindex/index-add.c b/bin/xbps-rindex/index-add.c index 4780082f..172d09cd 100644 --- a/bin/xbps-rindex/index-add.c +++ b/bin/xbps-rindex/index-add.c @@ -45,8 +45,6 @@ index_add(struct xbps_handle *xhp, int argc, char **argv, bool force) xbps_object_t obj, fileobj; struct xbps_repo *repo = NULL; struct stat st; - const char *arch; - char *sha256, *pkgver, *pkgname; char *tmprepodir = NULL, *repodir = NULL; int rv = 0, ret = 0; bool flush = false, found = false; @@ -79,6 +77,8 @@ index_add(struct xbps_handle *xhp, int argc, char **argv, bool force) * Process all packages specified in argv. */ for (int i = 0; i < argc; i++) { + const char *arch = NULL; + char *sha256 = NULL, *pkgver = NULL, *pkgname = NULL; /* * Read metadata props plist dictionary from binary package. */ @@ -195,6 +195,7 @@ index_add(struct xbps_handle *xhp, int argc, char **argv, bool force) */ if (!xbps_dictionary_set(idx, pkgname, binpkgd)) { free(pkgname); + free(pkgver); rv = EINVAL; goto out; }