DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Brian Dooley <brian.dooley@intel.com>
Subject: [PATCH 4/4] examples/fips_validation: remove unneeded null checks
Date: Wed, 22 Mar 2023 18:04:28 -0700	[thread overview]
Message-ID: <20230323010428.64020-5-stephen@networkplumber.org> (raw)
In-Reply-To: <20230323010428.64020-1-stephen@networkplumber.org>

No check for null pointer is necessary before calling free().

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 examples/fips_validation/main.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c
index 2c4353185edd..4c231fdb29cd 100644
--- a/examples/fips_validation/main.c
+++ b/examples/fips_validation/main.c
@@ -2288,8 +2288,7 @@ fips_mct_sha_test(void)
 
 	max_outlen = md_blocks * vec.cipher_auth.digest.len;
 
-	if (vec.cipher_auth.digest.val)
-		free(vec.cipher_auth.digest.val);
+	free(vec.cipher_auth.digest.val);
 
 	vec.cipher_auth.digest.val = calloc(1, max_outlen);
 
@@ -2382,8 +2381,7 @@ fips_mct_shake_test(void)
 
 	max_outlen = vec.cipher_auth.digest.len;
 
-	if (vec.cipher_auth.digest.val)
-		free(vec.cipher_auth.digest.val);
+	free(vec.cipher_auth.digest.val);
 
 	vec.cipher_auth.digest.val = calloc(1, max_outlen);
 
-- 
2.39.2


  parent reply	other threads:[~2023-03-23  1:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-23  1:04 [PATCH 0/4] Remove unnecessary null free checks Stephen Hemminger
2023-03-23  1:04 ` [PATCH 1/4] mldev: remove " Stephen Hemminger
2023-03-23  4:06   ` [EXT] " Srikanth Yalavarthi
2023-03-23  1:04 ` [PATCH 2/4] ml/cnkx: remove unnecessary null checks Stephen Hemminger
2023-03-23  4:14   ` [EXT] " Srikanth Yalavarthi
2023-03-23  1:04 ` [PATCH 3/4] graph: remove unnicessary " Stephen Hemminger
2023-03-23  1:04 ` Stephen Hemminger [this message]
2023-03-23  9:33 ` [PATCH 0/4] Remove unnecessary null free checks Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230323010428.64020-5-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=brian.dooley@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).