Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/1] rpmresolve.c: Fix unfreed pointers that keep DB opened
@ 2015-12-29 10:25 mariano.lopez
  2015-12-29 10:25 ` [PATCH 1/1] " mariano.lopez
  0 siblings, 1 reply; 2+ messages in thread
From: mariano.lopez @ 2015-12-29 10:25 UTC (permalink / raw)
  To: openembedded-core

From: Mariano Lopez <mariano.lopez@linux.intel.com>

When rpmresolve is used, it keeps the DB opened because
of unfreed pointers. This patch solve this issue.

[YOCTO #8028]

The following changes since commit 2cd061a29a94fdcdfec86732e6bcbb71c12c4afc:

  bluez5: include the patch only for 5.36 (2015-12-28 13:02:11 +0000)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib mariano/bug8028
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=mariano/bug8028

Mariano Lopez (1):
  rpmresolve.c: Fix unfreed pointers that keep DB opened

 meta/recipes-devtools/rpm/rpmresolve/rpmresolve.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

-- 
1.8.4.5



^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 1/1] rpmresolve.c: Fix unfreed pointers that keep DB opened
  2015-12-29 10:25 [PATCH 0/1] rpmresolve.c: Fix unfreed pointers that keep DB opened mariano.lopez
@ 2015-12-29 10:25 ` mariano.lopez
  0 siblings, 0 replies; 2+ messages in thread
From: mariano.lopez @ 2015-12-29 10:25 UTC (permalink / raw)
  To: openembedded-core

From: Mariano Lopez <mariano.lopez@linux.intel.com>

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]

Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
---
 meta/recipes-devtools/rpm/rpmresolve/rpmresolve.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/meta/recipes-devtools/rpm/rpmresolve/rpmresolve.c b/meta/recipes-devtools/rpm/rpmresolve/rpmresolve.c
index 7f4caf9..c0b4d56 100644
--- a/meta/recipes-devtools/rpm/rpmresolve/rpmresolve.c
+++ b/meta/recipes-devtools/rpm/rpmresolve/rpmresolve.c
@@ -42,7 +42,7 @@ FILE *outf;
 int getPackageStr(rpmts ts, const char *NVRA, rpmTag tag, char **value)
 {
     int rc = -1;
-    rpmmi mi = rpmtsInitIterator(ts, RPMTAG_NVRA, NVRA, 0);
+    rpmmi mi = rpmmiInit(rpmtsGetRdb(ts), RPMTAG_NVRA, NVRA, 0);
     Header h;
     if ((h = rpmmiNext(mi)) != NULL) {
         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 rc = 0;
-    rpmmi provmi = rpmtsInitIterator(ts, RPMTAG_PROVIDENAME, req, 0);
+    rpmmi provmi = rpmmiInit(rpmtsGetRdb(ts), RPMTAG_PROVIDENAME, req, 0);
     if(provmi) {
         Header h;
         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));
         int nkeys = argvCount(keys);
         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;
             if ((h = rpmmiNext(mi)) != NULL) {
                 /* Get name of package */
@@ -280,6 +280,8 @@ int printDepList(rpmts *ts, int tscount)
                         printf("DEBUG: %s requires null\n", name);
                     }
                     rc = 0;
+                    free(name);
+                    (void)rpmmiFree(mi);
                     continue;
                 }
                 ARGV_t reqs = (ARGV_t)he->p.ptr;
@@ -412,7 +414,7 @@ int main(int argc, char **argv)
     }
 
     for(i=0; i<tscount; i++)
-        (void) rpmtsCloseDB(ts[i]);
+        (void)rpmtsFree(ts[i]);
     free(ts);
 
     if( outfile ) {
-- 
1.8.4.5



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-29 18:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-29 10:25 [PATCH 0/1] rpmresolve.c: Fix unfreed pointers that keep DB opened mariano.lopez
2015-12-29 10:25 ` [PATCH 1/1] " mariano.lopez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox