projects
/
rrdtool.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added some freeing for error conditions
[rrdtool.git]
/
src
/
rrd_tool.c
diff --git
a/src/rrd_tool.c
b/src/rrd_tool.c
index
f536fa5
..
80bdb6e
100644
(file)
--- 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))) {
return *aLinePtr = linebuf;
bufsize += MAX_LENGTH;
if (!(linebuf = realloc(linebuf, bufsize))) {
+ free(linebuf);
perror("fgetslong: realloc");
exit(1);
}
perror("fgetslong: realloc");
exit(1);
}
@@
-448,6
+449,7
@@
int main(
while (fgetslong(&aLine, stdin)) {
if ((argc = CountArgs(aLine)) == 0) {
while (fgetslong(&aLine, stdin)) {
if ((argc = CountArgs(aLine)) == 0) {
+ free(aLine);
printf("ERROR: not enough arguments\n");
}
if ((myargv = (char **) malloc((argc + 1) *
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) {
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);
printf("ERROR: creating arguments\n");
} else {
int ret = HandleInputLine(argc, myargv, stdout);