mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 13:09:50 +00:00
rpmresolve.c: Fix unfreed pointers that keep DB opened
There are some unfreed rpmmi pointers in printDepList() function; this happens when the package have null as the requirement. This patch fixes these unfreed pointers and add small changes to keep consistency with some variables. [YOCTO #8028] (From OE-Core master rev: da7aa183f94adc1d0fff5bb81e827c584f9938ec) (From OE-Core rev: 8821b0443b4b39b3bd4f41800a6fc809197fda82) Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
528bdf528d
commit
c94eb07d53
@@ -42,7 +42,7 @@ FILE *outf;
|
|||||||
int getPackageStr(rpmts ts, const char *NVRA, rpmTag tag, char **value)
|
int getPackageStr(rpmts ts, const char *NVRA, rpmTag tag, char **value)
|
||||||
{
|
{
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
rpmmi mi = rpmtsInitIterator(ts, RPMTAG_NVRA, NVRA, 0);
|
rpmmi mi = rpmmiInit(rpmtsGetRdb(ts), RPMTAG_NVRA, NVRA, 0);
|
||||||
Header h;
|
Header h;
|
||||||
if ((h = rpmmiNext(mi)) != NULL) {
|
if ((h = rpmmiNext(mi)) != NULL) {
|
||||||
HE_t he = (HE_t) memset(alloca(sizeof(*he)), 0, sizeof(*he));
|
HE_t he = (HE_t) memset(alloca(sizeof(*he)), 0, sizeof(*he));
|
||||||
@@ -225,7 +225,7 @@ int processPackages(rpmts *ts, int tscount, const char *packagelistfn, int ignor
|
|||||||
int lookupProvider(rpmts ts, const char *req, char **provider)
|
int lookupProvider(rpmts ts, const char *req, char **provider)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
rpmmi provmi = rpmtsInitIterator(ts, RPMTAG_PROVIDENAME, req, 0);
|
rpmmi provmi = rpmmiInit(rpmtsGetRdb(ts), RPMTAG_PROVIDENAME, req, 0);
|
||||||
if(provmi) {
|
if(provmi) {
|
||||||
Header h;
|
Header h;
|
||||||
if ((h = rpmmiNext(provmi)) != NULL) {
|
if ((h = rpmmiNext(provmi)) != NULL) {
|
||||||
@@ -266,7 +266,7 @@ int printDepList(rpmts *ts, int tscount)
|
|||||||
HE_t he = (HE_t) memset(alloca(sizeof(*he)), 0, sizeof(*he));
|
HE_t he = (HE_t) memset(alloca(sizeof(*he)), 0, sizeof(*he));
|
||||||
int nkeys = argvCount(keys);
|
int nkeys = argvCount(keys);
|
||||||
for(i=0; i<nkeys; i++) {
|
for(i=0; i<nkeys; i++) {
|
||||||
rpmmi mi = rpmtsInitIterator(ts[0], RPMTAG_NVRA, keys[i], 0);
|
rpmmi mi = rpmmiInit(db, RPMTAG_NVRA, keys[i], 0);
|
||||||
Header h;
|
Header h;
|
||||||
if ((h = rpmmiNext(mi)) != NULL) {
|
if ((h = rpmmiNext(mi)) != NULL) {
|
||||||
/* Get name of package */
|
/* Get name of package */
|
||||||
@@ -280,6 +280,8 @@ int printDepList(rpmts *ts, int tscount)
|
|||||||
printf("DEBUG: %s requires null\n", name);
|
printf("DEBUG: %s requires null\n", name);
|
||||||
}
|
}
|
||||||
rc = 0;
|
rc = 0;
|
||||||
|
free(name);
|
||||||
|
(void)rpmmiFree(mi);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ARGV_t reqs = (ARGV_t)he->p.ptr;
|
ARGV_t reqs = (ARGV_t)he->p.ptr;
|
||||||
@@ -412,7 +414,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(i=0; i<tscount; i++)
|
for(i=0; i<tscount; i++)
|
||||||
(void) rpmtsCloseDB(ts[i]);
|
(void)rpmtsFree(ts[i]);
|
||||||
free(ts);
|
free(ts);
|
||||||
|
|
||||||
if( outfile ) {
|
if( outfile ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user