From f96b3d44b77a03ed47318aacfd246232fd24b099 Mon Sep 17 00:00:00 2001 From: oetiker Date: Wed, 27 Aug 2008 21:46:01 +0000 Subject: [PATCH] added some freeing for error conditions git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1467 a5681a0c-68f1-0310-ab6d-d61299d08faa --- src/rrd_tool.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/rrd_tool.c b/src/rrd_tool.c index f536fa5..80bdb6e 100644 --- a/src/rrd_tool.c +++ b/src/rrd_tool.c @@ -364,6 +364,7 @@ static char *fgetslong( return *aLinePtr = linebuf; bufsize += MAX_LENGTH; if (!(linebuf = realloc(linebuf, bufsize))) { + free(linebuf); perror("fgetslong: realloc"); exit(1); } @@ -448,6 +449,7 @@ int main( while (fgetslong(&aLine, stdin)) { if ((argc = CountArgs(aLine)) == 0) { + free(aLine); printf("ERROR: not enough arguments\n"); } if ((myargv = (char **) malloc((argc + 1) * @@ -456,6 +458,8 @@ int main( exit(1); } if ((argc = CreateArgs(argv[0], aLine, argc, myargv)) < 0) { + free(aLine); + free(myargv); printf("ERROR: creating arguments\n"); } else { int ret = HandleInputLine(argc, myargv, stdout); -- 2.11.0