From 0dfb9398bb6493d5a56216e0c7039cb3f9fc88c6 Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Tue, 24 Mar 2015 07:52:24 -0400 Subject: free NULL cleanup Start ensuring all OpenSSL "free" routines allow NULL, and remove any if check before calling them. This gets ASN1_OBJECT_free and ASN1_STRING_free. Reviewed-by: Matt Caswell --- crypto/asn1/asn1_par.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'crypto/asn1/asn1_par.c') diff --git a/crypto/asn1/asn1_par.c b/crypto/asn1/asn1_par.c index 20f3a88b85..574e8de867 100644 --- a/crypto/asn1/asn1_par.c +++ b/crypto/asn1/asn1_par.c @@ -276,10 +276,8 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length, nl = 1; } } - if (os != NULL) { - ASN1_OCTET_STRING_free(os); - os = NULL; - } + ASN1_OCTET_STRING_free(os); + os = NULL; } else if (tag == V_ASN1_INTEGER) { ASN1_INTEGER *bs; int i; @@ -356,10 +354,8 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length, } ret = 1; end: - if (o != NULL) - ASN1_OBJECT_free(o); - if (os != NULL) - ASN1_OCTET_STRING_free(os); + ASN1_OBJECT_free(o); + ASN1_OCTET_STRING_free(os); *pp = p; return (ret); } -- cgit v1.2.3