--- ca.c.orig	2016-03-01 18:08:42.795466224 -0800
+++ ca.c	2016-03-01 18:13:10.149445540 -0800
@@ -2107,6 +2107,10 @@
 
     tm = X509_get_notAfter(ret);
     row[DB_exp_date] = (char *)OPENSSL_malloc(tm->length + 1);
+    if (row[DB_exp_date] == NULL) {
+	BIO_printf(bio_err, "Memory allocation failure\n");
+	goto err;
+    }
     memcpy(row[DB_exp_date], tm->data, tm->length);
     row[DB_exp_date][tm->length] = '\0';
 
@@ -2116,7 +2120,7 @@
     row[DB_file] = (char *)OPENSSL_malloc(8);
     row[DB_name] = X509_NAME_oneline(X509_get_subject_name(ret), NULL, 0);
 
-    if ((row[DB_type] == NULL) || (row[DB_exp_date] == NULL) ||
+    if ((row[DB_type] == NULL) || 
         (row[DB_file] == NULL) || (row[DB_name] == NULL)) {
         BIO_printf(bio_err, "Memory allocation failure\n");
         goto err;
@@ -2375,6 +2379,10 @@
 
         tm = X509_get_notAfter(x509);
         row[DB_exp_date] = (char *)OPENSSL_malloc(tm->length + 1);
+	if (row[DB_exp_date] == NULL) {
+	    BIO_printf(bio_err, "Memory allocation failure\n");
+	    goto err;
+	}
         memcpy(row[DB_exp_date], tm->data, tm->length);
         row[DB_exp_date][tm->length] = '\0';
 
@@ -2385,8 +2393,7 @@
 
         /* row[DB_name] done already */
 
-        if ((row[DB_type] == NULL) || (row[DB_exp_date] == NULL) ||
-            (row[DB_file] == NULL)) {
+        if ((row[DB_type] == NULL) || (row[DB_file] == NULL)) {
             BIO_printf(bio_err, "Memory allocation failure\n");
             goto err;
         }
