summaryrefslogtreecommitdiff
path: root/rpm.c
diff options
context:
space:
mode:
authorjbj <devnull@localhost>1999-09-21 03:22:53 +0000
committerjbj <devnull@localhost>1999-09-21 03:22:53 +0000
commit20d78e939aa218e85ef19013769494851d863f13 (patch)
tree9fddb9815dafcdd8e7eb20bb4ec9fe3a80270b39 /rpm.c
parent78ce864c5eee9b2d4fc3a3a4a201818f4e500d50 (diff)
downloadlibrpm-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-xrpm.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/rpm.c b/rpm.c
index 44ed042be..c84f4d4e3 100755
--- a/rpm.c
+++ b/rpm.c
@@ -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);