projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Don't leak memory if realloc fails.
[openssl.git]
/
apps
/
apps.c
diff --git
a/apps/apps.c
b/apps/apps.c
index 537d43ab358b87d6b9fb1c94ac405af6e0a5f055..c7e01b0cc450de73efaf38f2d18b07fe0a45ee92 100644
(file)
--- a/
apps/apps.c
+++ b/
apps/apps.c
@@
-176,8
+176,6
@@
int chopup_args(ARGS *arg, char *buf)
if (arg->size == 0) {
arg->size = 20;
arg->argv = app_malloc(sizeof(*arg->argv) * arg->size, "argv space");
if (arg->size == 0) {
arg->size = 20;
arg->argv = app_malloc(sizeof(*arg->argv) * arg->size, "argv space");
- if (arg->argv == NULL)
- return 0;
}
for (p = buf;;) {
}
for (p = buf;;) {
@@
-189,11
+187,12
@@
int chopup_args(ARGS *arg, char *buf)
/* The start of something good :-) */
if (arg->argc >= arg->size) {
/* The start of something good :-) */
if (arg->argc >= arg->size) {
+ char **tmp;
arg->size += 20;
arg->size += 20;
- arg->argv = OPENSSL_realloc(arg->argv,
- sizeof(*arg->argv) * arg->size);
- if (arg->argv == NULL)
+ tmp = OPENSSL_realloc(arg->argv, sizeof(*arg->argv) * arg->size);
+ if (tmp == NULL)
return 0;
return 0;
+ arg->argv = tmp;
}
quoted = *p == '\'' || *p == '"';
if (quoted)
}
quoted = *p == '\'' || *p == '"';
if (quoted)