Fix various incorrect error function codes.
[openssl.git] / crypto / asn1 / a_bitstr.c
index c1d3c28210742e195564433b1ac77bce7bbaadb8..f621426d6f572a9d7d967d051bb245b143446cd3 100644 (file)
@@ -165,7 +165,7 @@ ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
        *pp=p;
        return(ret);
 err:
-       ASN1err(ASN1_F_D2I_ASN1_BIT_STRING,i);
+       ASN1err(ASN1_F_C2I_ASN1_BIT_STRING,i);
        if ((ret != NULL) && ((a == NULL) || (*a != ret)))
                M_ASN1_BIT_STRING_free(ret);
        return(NULL);
@@ -195,8 +195,12 @@ int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value)
                        c=(unsigned char *)OPENSSL_realloc_clean(a->data,
                                                                 a->length,
                                                                 w+1);
-               if (c == NULL) return(0);
-               if (w+1-a->length > 0) memset(c+a->length, 0, w+1-a->length);
+               if (c == NULL)
+                       {
+                       ASN1err(ASN1_F_ASN1_BIT_STRING_SET_BIT,ERR_R_MALLOC_FAILURE);
+                       return 0;
+                       }
+               if (w+1-a->length > 0) memset(c+a->length, 0, w+1-a->length);
                a->data=c;
                a->length=w+1;
        }