diff options
author | Nils Larsch <nils@openssl.org> | 2005-07-01 16:15:48 +0000 |
---|---|---|
committer | Nils Larsch <nils@openssl.org> | 2005-07-01 16:15:48 +0000 |
commit | 8b963f4ba481bb73b2edd2578569ad28229eac14 (patch) | |
tree | 39bcfdb7a1c4103957d0174a62a3a43ba847daa1 /apps | |
parent | 9152f07eaff7ae9775505cec2e8bf33b0407a21c (diff) |
initialize newly allocated data
PR: 1145
Diffstat (limited to 'apps')
-rw-r--r-- | apps/apps.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/apps/apps.c b/apps/apps.c index 9ae3e16ed3..248c65adb3 100644 --- a/apps/apps.c +++ b/apps/apps.c @@ -374,10 +374,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; |