diff options
Diffstat (limited to 'apps/engine.c')
-rw-r--r-- | apps/engine.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/apps/engine.c b/apps/engine.c index b60bfbc294..3b395b1c7d 100644 --- a/apps/engine.c +++ b/apps/engine.c @@ -107,13 +107,17 @@ static int append_buf(char **buf, int *size, const char *s) } if (strlen(*buf) + strlen(s) >= (unsigned int)*size) { + char *tmp; *size += 256; - *buf = OPENSSL_realloc(*buf, *size); + tmp = OPENSSL_realloc(*buf, *size); + if (tmp == NULL) { + OPENSSL_free(*buf); + *buf = NULL; + return 0; + } + *buf = tmp; } - if (*buf == NULL) - return 0; - if (**buf != '\0') OPENSSL_strlcat(*buf, ", ", *size); OPENSSL_strlcat(*buf, s, *size); |