From 2d29e2df0c9040e139d68c8659ee0342a6ac3dd1 Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Tue, 28 Apr 2015 16:34:52 -0400 Subject: realloc of NULL is like malloc ANSI C, and OpenSSL's malloc wrapper do this, also. Reviewed-by: Richard Levitte --- crypto/bio/b_sock.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'crypto/bio/b_sock.c') diff --git a/crypto/bio/b_sock.c b/crypto/bio/b_sock.c index ca485d9..a4fded5 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; -- cgit v1.1