diff options
author | Rich Salz <rsalz@openssl.org> | 2015-04-30 17:48:31 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2015-04-30 17:48:31 -0400 |
commit | 68dc682499ea3fe27d909c946d7abd39062d6efd (patch) | |
tree | 3478a6fb3699bdfa08d5871848696882ee1c24db /apps/engine.c | |
parent | 222561fe8ef510f336417a666f69f81ddc9b8fe4 (diff) |
In apps, malloc or die
No point in proceeding if you're out of memory. So change
*all* OPENSSL_malloc calls in apps to use the new routine which
prints a message and exits.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'apps/engine.c')
-rw-r--r-- | apps/engine.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/apps/engine.c b/apps/engine.c index 7dcc1b0817..448802bc61 100644 --- a/apps/engine.c +++ b/apps/engine.c @@ -98,9 +98,7 @@ static int append_buf(char **buf, const char *s, int *size, int step) if (*buf == NULL) { *size = step; - *buf = OPENSSL_malloc(*size); - if (*buf == NULL) - return 0; + *buf = app_malloc(*size, "engine buffer"); **buf = '\0'; } @@ -211,8 +209,7 @@ static int util_verbose(ENGINE *e, int verbose, BIO *out, const char *indent) if ((len = ENGINE_ctrl(e, ENGINE_CTRL_GET_NAME_LEN_FROM_CMD, num, NULL, NULL)) <= 0) goto err; - if ((name = OPENSSL_malloc(len + 1)) == NULL) - goto err; + name = app_malloc(len + 1, "name buffer"); if (ENGINE_ctrl(e, ENGINE_CTRL_GET_NAME_FROM_CMD, num, name, NULL) <= 0) goto err; @@ -221,8 +218,7 @@ static int util_verbose(ENGINE *e, int verbose, BIO *out, const char *indent) NULL, NULL)) < 0) goto err; if (len > 0) { - if ((desc = OPENSSL_malloc(len + 1)) == NULL) - goto err; + desc = app_malloc(len + 1, "description buffer"); if (ENGINE_ctrl(e, ENGINE_CTRL_GET_DESC_FROM_CMD, num, desc, NULL) <= 0) goto err; |