From: Nils Larsch Date: Fri, 1 Jul 2005 16:13:06 +0000 (+0000) Subject: initialize newly allocated data X-Git-Tag: OpenSSL_0_9_7h~15 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=e80f233749a55b3f8fd6b3d7dbc410710e2138e0;p=oweals%2Fopenssl.git initialize newly allocated data PR: 1145 --- diff --git a/apps/apps.c b/apps/apps.c index d646caa353..9b07e913c5 100644 --- a/apps/apps.c +++ b/apps/apps.c @@ -361,10 +361,17 @@ int chopup_args(ARGS *arg, char *buf, int *argc, char **argv[]) /* The start of something good :-) */ if (num >= arg->count) { - arg->count+=20; - arg->data=(char **)OPENSSL_realloc(arg->data, - sizeof(char *)*arg->count); - if (argc == 0) return(0); + char **tmp_p; + int tlen = arg->count + 20; + tmp_p = (char **)OPENSSL_realloc(arg->data, + sizeof(char *)*tlen); + if (tmp_p == NULL) + return 0; + arg->data = tmp_p; + arg->count = tlen; + /* initialize newly allocated data */ + for (i = num; i < arg->count; i++) + arg->data[i] = NULL; } arg->data[num++]=p;