summary refs log tree commit diff stats
path: root/src/common/util.c
diff options
context:
space:
mode:
authorRichardHitt <rbh00@netcom.com>2013-01-09 14:37:57 -0800
committerRichardHitt <rbh00@netcom.com>2013-01-09 14:37:57 -0800
commit6beef589e32d874e5d961e7e6f7b2a68c56538bd (patch)
treec27f129c1011d63570295117ea6cabd5e25e65f8 /src/common/util.c
parent285ddd0b60974bebbee6ea6168bf8d53262f6145 (diff)
Make source cleah with cppcheck, except for mpc and sasl
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 55cb530a..38537402 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -1319,8 +1319,17 @@ int my_poptParseArgvString(const char * s, int * argcPtr, char *** argvPtr) {
 	    if (*argv[argc]) {
 		buf++, argc++;
 		if (argc == argvAlloced) {
+		    char *temp[];
 		    argvAlloced += POPT_ARGV_ARRAY_GROW_DELTA;
-		    argv = realloc(argv, sizeof(*argv) * argvAlloced);
+		    temp = realloc(argv, sizeof(*argv) * argvAlloced);
+		    if (temp)
+			argv = temp;
+		    else
+		    {
+			free(argv);
+			free(bufStart);
+			return 1;
+		    }
 		}
 		argv[argc] = buf;
 	    }