Avoid alloca() in rpmInstall()
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 25 Apr 2008 10:54:59 +0000 (13:54 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 25 Apr 2008 12:29:12 +0000 (15:29 +0300)
lib/rpminstall.c

index 2b1196a..652dcd2 100644 (file)
@@ -210,7 +210,7 @@ struct rpmEIU {
 /** @todo Generalize --freshen policies. */
 int rpmInstall(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_t fileArgv)
 {
-    struct rpmEIU * eiu = memset(alloca(sizeof(*eiu)), 0, sizeof(*eiu));
+    struct rpmEIU * eiu = xcalloc(1, sizeof(*eiu));
     rpmps ps;
     rpmprobFilterFlags probFilter;
     rpmRelocation * relocations;
@@ -605,6 +605,7 @@ exit:
     eiu->pkgState = _free(eiu->pkgState);
     eiu->pkgURL = _free(eiu->pkgURL);
     eiu->argv = _free(eiu->argv);
+    free(eiu);
 
     rpmtsEmpty(ts);