]> git.ipfire.org Git - thirdparty/openssl.git/blobdiff - crypto/dso/dso_lib.c
Stop raising ERR_R_MALLOC_FAILURE in most places
[thirdparty/openssl.git] / crypto / dso / dso_lib.c
index e093b77a272dd81441700f8f94a9bef36a5119d9..a73d91e839718ea9c5e55456381390314f9b6032 100644 (file)
@@ -15,14 +15,12 @@ static DSO *DSO_new_method(DSO_METHOD *meth)
     DSO *ret;
 
     ret = OPENSSL_zalloc(sizeof(*ret));
-    if (ret == NULL) {
-        ERR_raise(ERR_LIB_DSO, ERR_R_MALLOC_FAILURE);
+    if (ret == NULL)
         return NULL;
-    }
     ret->meth_data = sk_void_new_null();
     if (ret->meth_data == NULL) {
         /* sk_new doesn't generate any errors so we do */
-        ERR_raise(ERR_LIB_DSO, ERR_R_MALLOC_FAILURE);
+        ERR_raise(ERR_LIB_DSO, ERR_R_CRYPTO_LIB);
         OPENSSL_free(ret);
         return NULL;
     }
@@ -30,7 +28,7 @@ static DSO *DSO_new_method(DSO_METHOD *meth)
     ret->references = 1;
     ret->lock = CRYPTO_THREAD_lock_new();
     if (ret->lock == NULL) {
-        ERR_raise(ERR_LIB_DSO, ERR_R_MALLOC_FAILURE);
+        ERR_raise(ERR_LIB_DSO, ERR_R_CRYPTO_LIB);
         sk_void_free(ret->meth_data);
         OPENSSL_free(ret);
         return NULL;
@@ -114,7 +112,7 @@ DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags)
     if (dso == NULL) {
         ret = DSO_new_method(meth);
         if (ret == NULL) {
-            ERR_raise(ERR_LIB_DSO, ERR_R_MALLOC_FAILURE);
+            ERR_raise(ERR_LIB_DSO, ERR_R_DSO_LIB);
             goto err;
         }
         allocated = 1;
@@ -241,10 +239,8 @@ int DSO_set_filename(DSO *dso, const char *filename)
     }
     /* We'll duplicate filename */
     copied = OPENSSL_strdup(filename);
-    if (copied == NULL) {
-        ERR_raise(ERR_LIB_DSO, ERR_R_MALLOC_FAILURE);
+    if (copied == NULL)
         return 0;
-    }
     OPENSSL_free(dso->filename);
     dso->filename = copied;
     return 1;
@@ -289,10 +285,8 @@ char *DSO_convert_filename(DSO *dso, const char *filename)
     }
     if (result == NULL) {
         result = OPENSSL_strdup(filename);
-        if (result == NULL) {
-            ERR_raise(ERR_LIB_DSO, ERR_R_MALLOC_FAILURE);
+        if (result == NULL)
             return NULL;
-        }
     }
     return result;
 }