Add checks for alloc failing.
[openssl.git] / crypto / ct / ct_log.c
index 13f7f39..ec6fa38 100644 (file)
@@ -198,6 +198,8 @@ int CTLOG_STORE_load_file(CTLOG_STORE *store, const char *file)
     char *enabled_logs;
     CTLOG_STORE_LOAD_CTX* load_ctx = ctlog_store_load_ctx_new();
 
+    if (load_ctx == NULL)
+        goto end;
     load_ctx->log_store = store;
     load_ctx->conf = NCONF_new(NULL);
     if (load_ctx->conf == NULL)
@@ -247,10 +249,10 @@ CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name)
         goto err;
     }
 
-    ret->public_key = public_key;
     if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1)
         goto err;
 
+    ret->public_key = public_key;
     return ret;
 err:
     CTLOG_free(ret);