summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2014-08-25 12:28:53 +0300
committerPanu Matilainen <pmatilai@redhat.com>2014-08-26 12:49:39 +0300
commit61fdfcff2b34e616fe8313fc6dece599732ccd63 (patch)
tree74c87b08385b135d849cde6973de4d7c4578820c
parent058a1ff7d26d0776387beac555e89c042396fdaf (diff)
downloadrpm-61fdfcff2b34e616fe8313fc6dece599732ccd63.tar.gz
Dirty kludgery to fix rpmdeps segfault (RhBug:1131892)
- Another regression from the recent rpmfc work, in rpmdeps context there's no spec or packages from it. Allocate a dummy package so we have some place to store the dependencies. And yes its ugly. (cherry picked from commit 49f2bb7d8fd91f2d8b22bf7128fd3defe4ed5434)
-rw-r--r--build/rpmfc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/build/rpmfc.c b/build/rpmfc.c
index f22053c72..99a7e9fc3 100644
--- a/build/rpmfc.c
+++ b/build/rpmfc.c
@@ -739,6 +739,7 @@ rpmfc rpmfcFree(rpmfc fc)
free(fc->fattrs);
free(fc->fcolor);
free(fc->fcdictx);
+ free(fc->pkg);
argiFree(fc->fddictx);
argiFree(fc->fddictn);
argiFree(fc->ddictx);
@@ -761,6 +762,7 @@ rpmfc rpmfcCreate(const char *buildRoot, rpmFlags flags)
fc->brlen = strlen(buildRoot);
}
fc->pool = rpmstrPoolCreate();
+ fc->pkg = xcalloc(1, sizeof(*fc->pkg));
return fc;
}
@@ -1261,6 +1263,7 @@ rpmRC rpmfcGenerateDepends(const rpmSpec spec, Package pkg)
av[ac] = NULL;
fc = rpmfcCreate(spec->buildRoot, 0);
+ free(fc->pkg);
fc->pkg = pkg;
fc->skipProv = !pkg->autoProv;
fc->skipReq = !pkg->autoReq;
@@ -1334,6 +1337,8 @@ exit:
printDeps(fc);
/* Clean up. */
+ if (fc)
+ fc->pkg = NULL;
free(fmode);
rpmfcFree(fc);
argvFree(av);