[PATCH] hmac: Fix memory leak

Clemens Lang cllang at redhat.com
Fri Feb 11 16:55:02 CET 2022


* src/hmac.c: Release HMAC256 context

--

LeakSanitizer marks the allocation of this context as leaked. Since the
hmac binary is used during the build with --enable-hmac-binary-check,
this fails the build with AddressSanitizer/LeakSanitizer.

Signed-off-by: Clemens Lang <cllang at redhat.com>
---
 src/hmac256.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/hmac256.c b/src/hmac256.c
index bd089b79..899e6d15 100644
--- a/src/hmac256.c
+++ b/src/hmac256.c
@@ -780,6 +780,7 @@ main (int argc, char **argv)
                        pgm, strerror (errno));
               exit (1);
             }
+          _gcry_hmac256_release (hd);
           if (use_stdin)
             break;
         }
-- 
2.34.1




More information about the Gcrypt-devel mailing list