summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-04-21 10:33:02 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-04-21 10:33:02 +0300
commitd2406a7e1754e7a7dc8136d9132929df36e5f230 (patch)
treeae215ba81221250b9e5903ffe5a85c3029ca5774 /lib
parentfe42db7ab8647b534cd9d080e72944ba7e1fb938 (diff)
downloadrpm-d2406a7e1754e7a7dc8136d9132929df36e5f230.tar.gz
rpm-d2406a7e1754e7a7dc8136d9132929df36e5f230.tar.bz2
rpm-d2406a7e1754e7a7dc8136d9132929df36e5f230.zip
Use argvAppend() instead of manual reallocs, plug a leak from rpmGlob()
Diffstat (limited to 'lib')
-rw-r--r--lib/rpminstall.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/rpminstall.c b/lib/rpminstall.c
index 908448f98..2b1196afe 100644
--- a/lib/rpminstall.c
+++ b/lib/rpminstall.c
@@ -216,9 +216,7 @@ int rpmInstall(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_t fileArgv)
rpmRelocation * relocations;
char * fileURL = NULL;
int stopInstall = 0;
- char ** av = NULL;
rpmVSFlags vsflags, ovsflags, tvsflags;
- int ac = 0;
int rc;
int xx;
int i;
@@ -259,8 +257,10 @@ int rpmInstall(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_t fileArgv)
/* Build fully globbed list of arguments in argv[argc]. */
for (eiu->fnp = fileArgv; *eiu->fnp != NULL; eiu->fnp++) {
+ ARGV_t av = NULL;
+ int ac = 0;
char * fn;
- av = _free(av); ac = 0;
+
fn = rpmEscapeSpaces(*eiu->fnp);
rc = rpmGlob(fn, &ac, &av);
fn = _free(fn);
@@ -269,12 +269,10 @@ int rpmInstall(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_t fileArgv)
continue;
}
- eiu->argv = xrealloc(eiu->argv, (eiu->argc+ac+1) * sizeof(*eiu->argv));
- memcpy(eiu->argv+eiu->argc, av, ac * sizeof(*av));
+ argvAppend(&(eiu->argv), av);
+ argvFree(av);
eiu->argc += ac;
- eiu->argv[eiu->argc] = NULL;
}
- av = _free(av); ac = 0;
restart:
/* Allocate sufficient storage for next set of args. */