diff options
author | TingPing <tingping@tingping.se> | 2013-01-09 19:53:26 -0800 |
---|---|---|
committer | TingPing <tingping@tingping.se> | 2013-01-09 19:53:26 -0800 |
commit | ba2927e3c5e797160be7dee8d90b78d035b76c93 (patch) | |
tree | 13d1891e6507aa6d28fef5a407821aa141e554e0 /src/common/util.c | |
parent | ed786843de94359a0f3dd9ccea1d3796c3a33d12 (diff) | |
parent | 672dbf75d6d3d47135be49568ebcce917d6c188c (diff) |
Merge pull request #368 from RichardHitt/pull360
Make source clean with cppcheck, except for mpc and sasl, closes #360
Diffstat (limited to 'src/common/util.c')
-rw-r--r-- | src/common/util.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/common/util.c b/src/common/util.c index 55cb530a..2319f75e 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; } |