diff options
author | Michael McConville <mmcc@cvs.openbsd.org> | 2015-12-23 20:37:24 +0000 |
---|---|---|
committer | Michael McConville <mmcc@cvs.openbsd.org> | 2015-12-23 20:37:24 +0000 |
commit | a207f4da75784a4af1a8eaa4aa3d0b429560c543 (patch) | |
tree | a4823e0133ee7d79b50aab20de9458db4b8e8bd6 | |
parent | 5cc1900068fdf65426e16559e57ad6f728354452 (diff) |
remove NULL-checks before free()
-rw-r--r-- | lib/libcrypto/asn1/asn_pack.c | 8 | ||||
-rw-r--r-- | lib/libcrypto/bio/bss_bio.c | 8 | ||||
-rw-r--r-- | lib/libcrypto/comp/c_zlib.c | 14 |
3 files changed, 11 insertions, 19 deletions
diff --git a/lib/libcrypto/asn1/asn_pack.c b/lib/libcrypto/asn1/asn_pack.c index f010f87bbdc..65f4b9bf97c 100644 --- a/lib/libcrypto/asn1/asn_pack.c +++ b/lib/libcrypto/asn1/asn_pack.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asn_pack.c,v 1.14 2014/07/11 13:41:59 miod Exp $ */ +/* $OpenBSD: asn_pack.c,v 1.15 2015/12/23 20:37:23 mmcc Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -180,10 +180,8 @@ ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_STRING **oct) } else octmp = *oct; - if (octmp->data) { - free(octmp->data); - octmp->data = NULL; - } + free(octmp->data); + octmp->data = NULL; if (!(octmp->length = ASN1_item_i2d(obj, &octmp->data, it))) { ASN1err(ASN1_F_ASN1_ITEM_PACK, ASN1_R_ENCODE_ERROR); diff --git a/lib/libcrypto/bio/bss_bio.c b/lib/libcrypto/bio/bss_bio.c index b5f13eb35c7..c817910d937 100644 --- a/lib/libcrypto/bio/bss_bio.c +++ b/lib/libcrypto/bio/bss_bio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bss_bio.c,v 1.21 2015/10/30 15:45:57 miod Exp $ */ +/* $OpenBSD: bss_bio.c,v 1.22 2015/12/23 20:37:23 mmcc Exp $ */ /* ==================================================================== * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved. * @@ -500,10 +500,8 @@ bio_ctrl(BIO *bio, int cmd, long num, void *ptr) size_t new_size = num; if (b->size != new_size) { - if (b->buf) { - free(b->buf); - b->buf = NULL; - } + free(b->buf); + b->buf = NULL; b->size = new_size; } ret = 1; diff --git a/lib/libcrypto/comp/c_zlib.c b/lib/libcrypto/comp/c_zlib.c index 4951ade8103..d9a3359313c 100644 --- a/lib/libcrypto/comp/c_zlib.c +++ b/lib/libcrypto/comp/c_zlib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: c_zlib.c,v 1.17 2014/11/03 16:58:28 tedu Exp $ */ +/* $OpenBSD: c_zlib.c,v 1.18 2015/12/23 20:37:23 mmcc Exp $ */ #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -524,18 +524,14 @@ bio_zlib_ctrl(BIO *b, int cmd, long num, void *ptr) } if (ibs != -1) { - if (ctx->ibuf) { - free(ctx->ibuf); - ctx->ibuf = NULL; - } + free(ctx->ibuf); + ctx->ibuf = NULL; ctx->ibufsize = ibs; } if (obs != -1) { - if (ctx->obuf) { - free(ctx->obuf); - ctx->obuf = NULL; - } + free(ctx->obuf); + ctx->obuf = NULL; ctx->obufsize = obs; } ret = 1; |