diff options
author | mmcc <mmcc@cvs.openbsd.org> | 2015-12-14 03:35:41 +0000 |
---|---|---|
committer | mmcc <mmcc@cvs.openbsd.org> | 2015-12-14 03:35:41 +0000 |
commit | ee79c8162553aa644b1459d96c3407ee0c87ddee (patch) | |
tree | be53968e63b309fb25b83395e437d02d8859266c /lib/libkeynote | |
parent | 20bd51316d1c518189628f741488001412be7dfe (diff) |
Remove NULL-checks before free().
Diffstat (limited to 'lib/libkeynote')
-rw-r--r-- | lib/libkeynote/auxil.c | 8 | ||||
-rw-r--r-- | lib/libkeynote/signature.c | 14 |
2 files changed, 8 insertions, 14 deletions
diff --git a/lib/libkeynote/auxil.c b/lib/libkeynote/auxil.c index 1bc550e7faa..3e8e4b4d1aa 100644 --- a/lib/libkeynote/auxil.c +++ b/lib/libkeynote/auxil.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auxil.c,v 1.10 2015/11/19 02:35:24 mmcc Exp $ */ +/* $OpenBSD: auxil.c,v 1.11 2015/12/14 03:35:40 mmcc Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu) * @@ -487,11 +487,9 @@ keynote_free_assertion(struct assertion *as) if (as == NULL) return; - if (as->as_buf != NULL) - free(as->as_buf); + free(as->as_buf); - if (as->as_signature != NULL) - free(as->as_signature); + free(as->as_signature); if (as->as_env != NULL) keynote_env_cleanup(&(as->as_env), 1); diff --git a/lib/libkeynote/signature.c b/lib/libkeynote/signature.c index e59c18bdd6c..3a0d3e8d8f9 100644 --- a/lib/libkeynote/signature.c +++ b/lib/libkeynote/signature.c @@ -1,4 +1,4 @@ -/* $OpenBSD: signature.c,v 1.19 2013/11/13 16:28:17 deraadt Exp $ */ +/* $OpenBSD: signature.c,v 1.20 2015/12/14 03:35:40 mmcc Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu) * @@ -563,16 +563,14 @@ kn_decode_key(struct keynote_deckey *dc, char *key, int keytype) { if ((px509Cert = X509_new()) == (X509 *) NULL) { - if (ptr) - free(ptr); + free(ptr); keynote_errno = ERROR_MEMORY; return -1; } if(d2i_X509(&px509Cert, (const unsigned char **)&decoded, len) == NULL) { - if (ptr) - free(ptr); + free(ptr); X509_free(px509Cert); keynote_errno = ERROR_SYNTAX; return -1; @@ -580,8 +578,7 @@ kn_decode_key(struct keynote_deckey *dc, char *key, int keytype) if ((pPublicKey = X509_get_pubkey(px509Cert)) == (EVP_PKEY *) NULL) { - if (ptr) - free(ptr); + free(ptr); X509_free(px509Cert); keynote_errno = ERROR_SYNTAX; return -1; @@ -590,8 +587,7 @@ kn_decode_key(struct keynote_deckey *dc, char *key, int keytype) /* RSA-specific */ dc->dec_key = pPublicKey->pkey.rsa; - if(ptr) - free(ptr); + free(ptr); return 0; } |