the XXXfree functions being called accept NULL, so don't check first.
authorderaadt <deraadt@openbsd.org>
Tue, 2 May 2017 04:11:08 +0000 (04:11 +0000)
committerderaadt <deraadt@openbsd.org>
Tue, 2 May 2017 04:11:08 +0000 (04:11 +0000)
ok beck

lib/libcrypto/x509v3/v3_crld.c
lib/libcrypto/x509v3/v3_ncons.c
lib/libcrypto/x509v3/v3_pci.c

index f9f69fe..8660c1e 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: v3_crld.c,v 1.21 2017/01/29 17:49:23 beck Exp $ */
+/* $OpenBSD: v3_crld.c,v 1.22 2017/05/02 04:11:08 deraadt Exp $ */
 /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
  * project 1999.
  */
@@ -186,10 +186,8 @@ set_dist_point_name(DIST_POINT_NAME **pdp, X509V3_CTX *ctx, CONF_VALUE *cnf)
        return 1;
 
 err:
-       if (fnm)
-               sk_GENERAL_NAME_pop_free(fnm, GENERAL_NAME_free);
-       if (rnm)
-               sk_X509_NAME_ENTRY_pop_free(rnm, X509_NAME_ENTRY_free);
+       sk_GENERAL_NAME_pop_free(fnm, GENERAL_NAME_free);
+       sk_X509_NAME_ENTRY_pop_free(rnm, X509_NAME_ENTRY_free);
        return -1;
 }
 
@@ -300,8 +298,7 @@ crldp_from_section(X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval)
        return point;
 
 err:
-       if (point)
-               DIST_POINT_free(point);
+       DIST_POINT_free(point);
        return NULL;
 }
 
index 8864398..d22ca5e 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: v3_ncons.c,v 1.11 2017/01/29 17:49:23 beck Exp $ */
+/* $OpenBSD: v3_ncons.c,v 1.12 2017/05/02 04:11:08 deraadt Exp $ */
 /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
  * project.
  */
@@ -223,11 +223,8 @@ v2i_NAME_CONSTRAINTS(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
 memerr:
        X509V3error(ERR_R_MALLOC_FAILURE);
 err:
-       if (ncons)
-               NAME_CONSTRAINTS_free(ncons);
-       if (sub)
-               GENERAL_SUBTREE_free(sub);
-
+       NAME_CONSTRAINTS_free(ncons);
+       GENERAL_SUBTREE_free(sub);
        return NULL;
 }
 
index dd01545..437b3ae 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: v3_pci.c,v 1.12 2017/01/29 17:49:23 beck Exp $ */
+/* $OpenBSD: v3_pci.c,v 1.13 2017/05/02 04:11:08 deraadt Exp $ */
 /* Contributed to the OpenSSL Project 2004
  * by Richard Levitte (richard@levitte.org)
  */
@@ -298,18 +298,12 @@ r2i_pci(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, char *value)
        goto end;
 
 err:
-       if (language) {
-               ASN1_OBJECT_free(language);
-               language = NULL;
-       }
-       if (pathlen) {
-               ASN1_INTEGER_free(pathlen);
-               pathlen = NULL;
-       }
-       if (policy) {
-               ASN1_OCTET_STRING_free(policy);
-               policy = NULL;
-       }
+       ASN1_OBJECT_free(language);
+       language = NULL;
+       ASN1_INTEGER_free(pathlen);
+       pathlen = NULL;
+       ASN1_OCTET_STRING_free(policy);
+       policy = NULL;
 end:
        sk_CONF_VALUE_pop_free(vals, X509V3_conf_free);
        return pci;