realloc of NULL is like malloc
[openssl.git] / crypto / asn1 / a_bitstr.c
index 8a9e17cb27c3e7c78e872869da065abd663607e2..ba243f1a5f5c47b1dc09fff8632fa7c7a7cc0186 100644 (file)
@@ -205,10 +205,7 @@ int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value)
     if ((a->length < (w + 1)) || (a->data == NULL)) {
         if (!value)
             return (1);         /* Don't need to set */
-        if (a->data == NULL)
-            c = OPENSSL_malloc(w + 1);
-        else
-            c = OPENSSL_realloc_clean(a->data, a->length, w + 1);
+        c = OPENSSL_realloc_clean(a->data, a->length, w + 1);
         if (c == NULL) {
             ASN1err(ASN1_F_ASN1_BIT_STRING_SET_BIT, ERR_R_MALLOC_FAILURE);
             return 0;