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.
This commit is contained in:
Panu Matilainen 2014-08-25 12:28:53 +03:00
parent 8b540fbf1b
commit 49f2bb7d8f
1 changed files with 5 additions and 0 deletions

View File

@ -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);