Check for failed malloc in BIO_ADDR_new
authorMatt Caswell <matt@openssl.org>
Fri, 29 Apr 2016 10:27:09 +0000 (11:27 +0100)
committerMatt Caswell <matt@openssl.org>
Fri, 29 Apr 2016 15:47:41 +0000 (16:47 +0100)
BIO_ADDR_new() calls OPENSSL_zalloc() which can fail - but the return
value is not checked.

Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/bio/b_addr.c

index bfc745b..86c6c7e 100644 (file)
@@ -83,6 +83,9 @@ BIO_ADDR *BIO_ADDR_new(void)
 {
     BIO_ADDR *ret = OPENSSL_zalloc(sizeof(*ret));
 
+    if (ret == NULL)
+        return NULL;
+
     ret->sa.sa_family = AF_UNSPEC;
     return ret;
 }