Plug memleak from %pretrans
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 8 Aug 2008 09:49:41 +0000 (12:49 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 8 Aug 2008 09:49:41 +0000 (12:49 +0300)
- te->fi needs to be freed if we replace it...

lib/transaction.c

index 7e432a3..1f99384 100644 (file)
@@ -898,7 +898,6 @@ static int runTransScripts(rpmts ts, rpmTag stag)
            script = fi->posttrans;
            scriptprog = fi->posttransprog;
            progtag = RPMTAG_POSTTRANSPROG;
-           p->fi = rpmfiFree(p->fi);
            break;
        default:
            /* programmer error, blow up */
@@ -934,6 +933,7 @@ static int runTransScripts(rpmts ts, rpmTag stag)
         }
 
        if (rpmteFd(p) != NULL) {
+           p->fi = rpmfiFree(p->fi);
            fi = rpmfiNew(ts, p->h, RPMTAG_BASENAMES, 1);
            if (fi != NULL) {   /* XXX can't happen */
                if (stag == RPMTAG_PRETRANS) {