diff options
author | jbj <devnull@localhost> | 1999-09-21 03:22:53 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 1999-09-21 03:22:53 +0000 |
commit | 20d78e939aa218e85ef19013769494851d863f13 (patch) | |
tree | 9fddb9815dafcdd8e7eb20bb4ec9fe3a80270b39 /rpm.c | |
parent | 78ce864c5eee9b2d4fc3a3a4a201818f4e500d50 (diff) | |
download | librpm-tizen-20d78e939aa218e85ef19013769494851d863f13.tar.gz librpm-tizen-20d78e939aa218e85ef19013769494851d863f13.tar.bz2 librpm-tizen-20d78e939aa218e85ef19013769494851d863f13.zip |
fix: command line install had header memory leak.
check for NULL on all memory allocations.
free rpmrc mallocs on exit.
permit run time leak detection.
CVS patchset: 3311
CVS date: 1999/09/21 03:22:53
Diffstat (limited to 'rpm.c')
-rwxr-xr-x | rpm.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -1,11 +1,10 @@ #include "system.h" -#include "build/rpmbuild.h" +#include "rpmbuild.h" #include "build.h" #include "install.h" -#include "lib/signature.h" -#include "popt/popt.h" +#include "signature.h" #define GETOPT_REBUILD 1003 #define GETOPT_RECOMPILE 1004 @@ -824,7 +823,7 @@ int main(int argc, char ** argv) *errString++ = '\0'; if (*errString != '/') argerror(_("relocations must have a / following the =")); - relocations = realloc(relocations, + relocations = xrealloc(relocations, sizeof(*relocations) * (numRelocations + 1)); relocations[numRelocations].oldPath = optArg; relocations[numRelocations++].newPath = errString; @@ -834,7 +833,7 @@ int main(int argc, char ** argv) if (*optArg != '/') argerror(_("exclude paths must begin with a /")); - relocations = realloc(relocations, + relocations = xrealloc(relocations, sizeof(*relocations) * (numRelocations + 1)); relocations[numRelocations].oldPath = optArg; relocations[numRelocations++].newPath = NULL; @@ -1089,7 +1088,7 @@ int main(int argc, char ** argv) exit(EXIT_FAILURE); } fprintf(stderr, _("Pass phrase is good.\n")); - passPhrase = strdup(passPhrase); + passPhrase = xstrdup(passPhrase); break; default: fprintf(stderr, @@ -1298,7 +1297,7 @@ int main(int argc, char ** argv) relocations[0].newPath = prefix; relocations[1].oldPath = relocations[1].newPath = NULL; } else if (relocations) { - relocations = realloc(relocations, + relocations = xrealloc(relocations, sizeof(*relocations) * (numRelocations + 1)); relocations[numRelocations].oldPath = NULL; relocations[numRelocations].newPath = NULL; @@ -1346,6 +1345,8 @@ int main(int argc, char ** argv) } poptFreeContext(optCon); + freeMacros(NULL); + rpmFreeRpmrc(); if (pipeChild) { fclose(stdout); |