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 bfc745b76960405128c43f18da512309e48fcb27..86c6c7eca883fb25a857aa089a6cfc938e05c699 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;
 }