Plug some memory leaks.

Patches from rpm5.org / JBJ.
This commit is contained in:
Panu Matilainen 2007-07-02 15:02:15 +03:00
parent 0195ea4a5a
commit de50397c71
3 changed files with 6 additions and 2 deletions

View File

@ -816,6 +816,7 @@ rpmalAllSatisfiesDepend(const rpmal al, const rpmds ds, alKey * keyp)
if (ret != NULL && *ret != NULL)
return ret;
/* ... then, look for files "provided" by package. */
ret = _free(ret);
}
ai = &al->index;

View File

@ -1440,7 +1440,8 @@ static void rpmSetVarArch(int var, const char * val, const char * arch)
}
}
next->value = xstrdup(val); /* XXX memory leak, hard to plug */
next->value = _free(next->value);
next->value = xstrdup(val);
next->arch = (arch ? xstrdup(arch) : NULL);
}

View File

@ -1998,8 +1998,10 @@ rpmInitMacros(MacroContext mc, const char * macrofiles)
continue;
/* Read macros from each file. */
for (i = 0; i < ac; i++)
for (i = 0; i < ac; i++) {
(void) rpmLoadMacroFile(mc, av[i]);
av[i] = _free(av[i]);
}
av = _free(av);
}
mfiles = _free(mfiles);