Commit ed57d1e06d for openssl.org

commit ed57d1e06dca28689190e00d9893e0fd7ecc67c1
Author: Eugene Syromiatnikov <esyr@openssl.org>
Date:   Mon Jan 26 09:54:31 2026 +0100

    test/evp_test.c: avoid resource leak in digest_test_run()

    The function can return on ctrl2params() returning 0 without freeing
    the allocated memory associated with the got pointer.  Fix it by jumping
    to the err label that performs the cleanup instead of returning
    immediately.

    Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1680647
    Fixes: 9c738431411e "Add support for CSHAKE."
    Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

    Reviewed-by: Tomas Mraz <tomas@openssl.org>
    Reviewed-by: Paul Dale <paul.dale@oracle.com>
    Reviewed-by: Norbert Pocs <norbertp@openssl.org>
    Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
    Reviewed-by: Neil Horman <nhorman@openssl.org>
    MergeDate: Wed Jan 28 12:57:04 2026
    (Merged from https://github.com/openssl/openssl/pull/29757)

diff --git a/test/evp_test.c b/test/evp_test.c
index bd7ae80502..64d7b52b5b 100644
--- a/test/evp_test.c
+++ b/test/evp_test.c
@@ -835,7 +835,7 @@ static int digest_test_run(EVP_TEST *t)
     if (sk_OPENSSL_STRING_num(expected->controls) > 0) {
         if (!ctrl2params(t, expected->controls, defined_params,
                 params, OSSL_NELEM(params), &params_n))
-            return 0;
+            goto err;
         p = params + params_n;
     }