[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor] branch main updated: test: Fix a mem leak reported by Coverity



This is an automated email from the git hooks/post-receive script.

dgoulet pushed a commit to branch main
in repository tor.

The following commit(s) were added to refs/heads/main by this push:
     new faff592c3b test: Fix a mem leak reported by Coverity
faff592c3b is described below

commit faff592c3bc4c3bdebd8ac3c24bd23c50dc4c833
Author: David Goulet <dgoulet@xxxxxxxxxxxxxx>
AuthorDate: Thu Jun 1 08:35:08 2023 -0400

    test: Fix a mem leak reported by Coverity
    
    Here is the report:
    
      *** CID 1531835:  Resource leaks  (RESOURCE_LEAK)
      /src/test/test_crypto_slow.c: 683 in test_crypto_equix()
      677
      678           /* Solve phase: Make sure the test vector matches */
      679           memset(&output, 0xa5, sizeof output);
      680           equix_result result;
      681           result = equix_solve(solve_ctx, challenge_literal,
      682                                challenge_len, &output);
      >>>     CID 1531835:  Resource leaks  (RESOURCE_LEAK)
      >>>     Variable "solve_ctx" going out of scope leaks the storage it points to.
    
    Signed-off-by: David Goulet <dgoulet@xxxxxxxxxxxxxx>
---
 src/test/test_crypto_slow.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/test/test_crypto_slow.c b/src/test/test_crypto_slow.c
index 23bc7a852f..3c44b8ded8 100644
--- a/src/test/test_crypto_slow.c
+++ b/src/test/test_crypto_slow.c
@@ -680,6 +680,7 @@ test_crypto_equix(void *arg)
       equix_result result;
       result = equix_solve(solve_ctx, challenge_literal,
                            challenge_len, &output);
+      equix_free(solve_ctx);
       tt_int_op(result, OP_EQ, EQUIX_OK);
       tt_int_op(output.count, OP_EQ, num_sols);
       tt_int_op(output.flags, OP_EQ, sol_flags);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits