summaryrefslogtreecommitdiffstats
path: root/apps/ca.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2015-10-30 11:18:04 +0000
committerMatt Caswell <matt@openssl.org>2015-11-09 22:48:41 +0000
commit96487cddd408e247819c4f122bd86e53ae4bd6c0 (patch)
treef6b424b2ce4d1d6ae2604b26d9fb956e13f932a2 /apps/ca.c
parent90945fa31a42dcf3beb90540c618e4d627c595ea (diff)
Continue standardisation of malloc handling in apps
continue on from previous commits but in the apps directory Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Diffstat (limited to 'apps/ca.c')
-rw-r--r--apps/ca.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/apps/ca.c b/apps/ca.c
index 691f4e78b3..eea9d99cb4 100644
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -1165,7 +1165,7 @@ end_of_options:
goto end;
tmptm = ASN1_TIME_new();
- if (!tmptm)
+ if (tmptm == NULL)
goto end;
X509_gmtime_adj(tmptm, 0);
X509_CRL_set_lastUpdate(crl, tmptm);
@@ -2283,10 +2283,12 @@ static int do_updatedb(CA_DB *db)
char **rrow, *a_tm_s;
a_tm = ASN1_UTCTIME_new();
+ if (a_tm == NULL)
+ return -1;
/* get actual time and make a string */
a_tm = X509_gmtime_adj(a_tm, 0);
- a_tm_s = (char *)OPENSSL_malloc(a_tm->length + 1);
+ a_tm_s = (char *)app_malloc(a_tm->length + 1, "time string");
memcpy(a_tm_s, a_tm->data, a_tm->length);
a_tm_s[a_tm->length] = '\0';
@@ -2470,7 +2472,7 @@ int make_revoked(X509_REVOKED *rev, const char *str)
if (rev && (reason_code != OCSP_REVOKED_STATUS_NOSTATUS)) {
rtmp = ASN1_ENUMERATED_new();
- if (!rtmp || !ASN1_ENUMERATED_set(rtmp, reason_code))
+ if (rtmp == NULL || !ASN1_ENUMERATED_set(rtmp, reason_code))
goto end;
if (!X509_REVOKED_add1_ext_i2d(rev, NID_crl_reason, rtmp, 0, 0))
goto end;
@@ -2576,7 +2578,7 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
if (prevtm) {
*prevtm = ASN1_UTCTIME_new();
- if (!*prevtm) {
+ if (*prevtm == NULL) {
BIO_printf(bio_err, "memory allocation failure\n");
goto end;
}
@@ -2622,7 +2624,7 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
goto end;
}
comp_time = ASN1_GENERALIZEDTIME_new();
- if (!comp_time) {
+ if (comp_time == NULL) {
BIO_printf(bio_err, "memory allocation failure\n");
goto end;
}