Collin Funk <[email protected]> writes:

> This patch removes the internal calls to free on errors to leave it up
> to the caller. It also protects against double frees by setting the
> pointer to NULL on sha3_free_ctx, and adds tests that would otherwise
> segfault.

Embarrassing typo fix attached the lets the code compile.

In my defense I was using $GNULIB_REFDIR, but thought I was using
$GNULIB_SRCDIR. So the sources from my ./bootstrap were not links to my
local clones sources as I thought.

Collin

>From 68ecc26f30b284a26ab9aa0a08299869ea713c71 Mon Sep 17 00:00:00 2001
Message-ID: <68ecc26f30b284a26ab9aa0a08299869ea713c71.1757203326.git.collin.fu...@gmail.com>
From: Collin Funk <[email protected]>
Date: Sat, 6 Sep 2025 16:57:58 -0700
Subject: [PATCH] crypo/sha3: Fix typo from the previous commit.

* lib/sha3-stream.c (sha3_xxx_stream): Add missing &'s since
sha3_free_ctx expects a pointer.
---
 ChangeLog         | 4 ++++
 lib/sha3-stream.c | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 49505aaaf9..88a4016002 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2025-09-06  Collin Funk  <[email protected]>
 
+	crypo/sha3: Fix typo from the previous commit.
+	* lib/sha3-stream.c (sha3_xxx_stream): Add missing &'s since
+	sha3_free_ctx expects a pointer.
+
 	crypto/sha3-buffer, crypto/sha3: Protect against double frees (regr. today).
 	* lib/sha3.c (sha3_free_ctx): Only free the EVP_MD_CTX if it is not
 	NULL, and set it to NULL after freeing.
diff --git a/lib/sha3-stream.c b/lib/sha3-stream.c
index d071ea06f9..adf55457c4 100644
--- a/lib/sha3-stream.c
+++ b/lib/sha3-stream.c
@@ -57,7 +57,7 @@ sha3_xxx_stream (FILE *stream, char const *alg, void *resblock,
   if (! init_ctx (&ctx))
     {
       free (buffer);
-      sha3_free_ctx (ctx);
+      sha3_free_ctx (&ctx);
       return 1;
     }
   size_t sum;
@@ -137,7 +137,7 @@ sha3_xxx_stream (FILE *stream, char const *alg, void *resblock,
       return 1;
     }
 
-  sha3_free_ctx (ctx);
+  sha3_free_ctx (&ctx);
   return 0;
 }
 
-- 
2.51.0

Reply via email to