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/bio/b_sock.c | |
parent | b196e7d936fb377d9c5b305748ac25ff0e53ef6d (diff) |
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/bio/b_sock.c')
-rw-r--r-- | crypto/bio/b_sock.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/crypto/bio/b_sock.c b/crypto/bio/b_sock.c index ca485d9c19..a4fded5ec2 100644 --- a/crypto/bio/b_sock.c +++ b/crypto/bio/b_sock.c @@ -673,12 +673,9 @@ int BIO_accept(int sock, char **addr) break; nl = strlen(h) + strlen(s) + 2; p = *addr; - if (p) { + if (p) *p = '\0'; - p = OPENSSL_realloc(p, nl); - } else { - p = OPENSSL_malloc(nl); - } + p = OPENSSL_realloc(p, nl); if (p == NULL) { BIOerr(BIO_F_BIO_ACCEPT, ERR_R_MALLOC_FAILURE); goto end; |