diff options
author | Mariano Lopez <mariano.lopez@linux.intel.com> | 2015-12-29 10:25:02 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-01-11 23:26:30 +0000 |
commit | eda3947cf06252346dfd89f626b2560092219242 (patch) | |
tree | abde0f9dea0cb54db2a258c775a27760c761ad4e /meta/recipes-devtools/rpm/rpmresolve | |
parent | 3c8a45180f430416a47af434f7fdc7246ad89cf4 (diff) | |
download | poky-eda3947cf06252346dfd89f626b2560092219242.tar.gz |
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 rev: da7aa183f94adc1d0fff5bb81e827c584f9938ec)
Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/rpm/rpmresolve')
-rw-r--r-- | meta/recipes-devtools/rpm/rpmresolve/rpmresolve.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/meta/recipes-devtools/rpm/rpmresolve/rpmresolve.c b/meta/recipes-devtools/rpm/rpmresolve/rpmresolve.c index 7f4caf9886..c0b4d567fb 100644 --- a/meta/recipes-devtools/rpm/rpmresolve/rpmresolve.c +++ b/meta/recipes-devtools/rpm/rpmresolve/rpmresolve.c | |||
@@ -42,7 +42,7 @@ FILE *outf; | |||
42 | int getPackageStr(rpmts ts, const char *NVRA, rpmTag tag, char **value) | 42 | int getPackageStr(rpmts ts, const char *NVRA, rpmTag tag, char **value) |
43 | { | 43 | { |
44 | int rc = -1; | 44 | int rc = -1; |
45 | rpmmi mi = rpmtsInitIterator(ts, RPMTAG_NVRA, NVRA, 0); | 45 | rpmmi mi = rpmmiInit(rpmtsGetRdb(ts), RPMTAG_NVRA, NVRA, 0); |
46 | Header h; | 46 | Header h; |
47 | if ((h = rpmmiNext(mi)) != NULL) { | 47 | if ((h = rpmmiNext(mi)) != NULL) { |
48 | HE_t he = (HE_t) memset(alloca(sizeof(*he)), 0, sizeof(*he)); | 48 | 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 | |||
225 | int lookupProvider(rpmts ts, const char *req, char **provider) | 225 | int lookupProvider(rpmts ts, const char *req, char **provider) |
226 | { | 226 | { |
227 | int rc = 0; | 227 | int rc = 0; |
228 | rpmmi provmi = rpmtsInitIterator(ts, RPMTAG_PROVIDENAME, req, 0); | 228 | rpmmi provmi = rpmmiInit(rpmtsGetRdb(ts), RPMTAG_PROVIDENAME, req, 0); |
229 | if(provmi) { | 229 | if(provmi) { |
230 | Header h; | 230 | Header h; |
231 | if ((h = rpmmiNext(provmi)) != NULL) { | 231 | if ((h = rpmmiNext(provmi)) != NULL) { |
@@ -266,7 +266,7 @@ int printDepList(rpmts *ts, int tscount) | |||
266 | HE_t he = (HE_t) memset(alloca(sizeof(*he)), 0, sizeof(*he)); | 266 | HE_t he = (HE_t) memset(alloca(sizeof(*he)), 0, sizeof(*he)); |
267 | int nkeys = argvCount(keys); | 267 | int nkeys = argvCount(keys); |
268 | for(i=0; i<nkeys; i++) { | 268 | for(i=0; i<nkeys; i++) { |
269 | rpmmi mi = rpmtsInitIterator(ts[0], RPMTAG_NVRA, keys[i], 0); | 269 | rpmmi mi = rpmmiInit(db, RPMTAG_NVRA, keys[i], 0); |
270 | Header h; | 270 | Header h; |
271 | if ((h = rpmmiNext(mi)) != NULL) { | 271 | if ((h = rpmmiNext(mi)) != NULL) { |
272 | /* Get name of package */ | 272 | /* Get name of package */ |
@@ -280,6 +280,8 @@ int printDepList(rpmts *ts, int tscount) | |||
280 | printf("DEBUG: %s requires null\n", name); | 280 | printf("DEBUG: %s requires null\n", name); |
281 | } | 281 | } |
282 | rc = 0; | 282 | rc = 0; |
283 | free(name); | ||
284 | (void)rpmmiFree(mi); | ||
283 | continue; | 285 | continue; |
284 | } | 286 | } |
285 | ARGV_t reqs = (ARGV_t)he->p.ptr; | 287 | ARGV_t reqs = (ARGV_t)he->p.ptr; |
@@ -412,7 +414,7 @@ int main(int argc, char **argv) | |||
412 | } | 414 | } |
413 | 415 | ||
414 | for(i=0; i<tscount; i++) | 416 | for(i=0; i<tscount; i++) |
415 | (void) rpmtsCloseDB(ts[i]); | 417 | (void)rpmtsFree(ts[i]); |
416 | free(ts); | 418 | free(ts); |
417 | 419 | ||
418 | if( outfile ) { | 420 | if( outfile ) { |