diff options
author | Rich Salz <rsalz@openssl.org> | 2015-04-28 16:34:52 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2015-04-28 16:34:52 -0400 |
commit | 2d29e2df0c9040e139d68c8659ee0342a6ac3dd1 (patch) | |
tree | 1c204074c02b3e356e60b51abe82e4552983bc80 /crypto/buffer | |
parent | b196e7d936fb377d9c5b305748ac25ff0e53ef6d (diff) | |
download | openssl-2d29e2df0c9040e139d68c8659ee0342a6ac3dd1.tar.gz |
realloc of NULL is like malloc
ANSI C, and OpenSSL's malloc wrapper do this, also.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/buffer')
-rw-r--r-- | crypto/buffer/buffer.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/crypto/buffer/buffer.c b/crypto/buffer/buffer.c index 0859974e79..c77fdc5ccb 100644 --- a/crypto/buffer/buffer.c +++ b/crypto/buffer/buffer.c @@ -114,10 +114,7 @@ size_t BUF_MEM_grow(BUF_MEM *str, size_t len) return 0; } n = (len + 3) / 3 * 4; - if (str->data == NULL) - ret = OPENSSL_malloc(n); - else - ret = OPENSSL_realloc(str->data, n); + ret = OPENSSL_realloc(str->data, n); if (ret == NULL) { BUFerr(BUF_F_BUF_MEM_GROW, ERR_R_MALLOC_FAILURE); len = 0; @@ -151,10 +148,7 @@ size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len) return 0; } n = (len + 3) / 3 * 4; - if (str->data == NULL) - ret = OPENSSL_malloc(n); - else - ret = OPENSSL_realloc_clean(str->data, str->max, n); + ret = OPENSSL_realloc_clean(str->data, str->max, n); if (ret == NULL) { BUFerr(BUF_F_BUF_MEM_GROW_CLEAN, ERR_R_MALLOC_FAILURE); len = 0; |