[tor-commits] [tor/main] test_hs_ob: initialize pointers to NULL

nickm at torproject.org nickm at torproject.org
Mon Jul 12 20:27:02 UTC 2021


commit a11a9bb3a0ebdba5c4a283012cc35d5077ee796c
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon Jul 12 14:59:29 2021 -0400

    test_hs_ob: initialize pointers to NULL
    
    This is an attempt to fix CID 1486280, where coverity warns us that,
    if the tests failed, we might free() an uninitialized pointer.
---
 src/test/test_hs_ob.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/test/test_hs_ob.c b/src/test/test_hs_ob.c
index 3485655c2e..2f69bf31e0 100644
--- a/src/test/test_hs_ob.c
+++ b/src/test/test_hs_ob.c
@@ -174,6 +174,7 @@ test_get_subcredentials(void *arg)
   hs_subcredential_t *subcreds = NULL;
 
   (void) arg;
+  memset(&config, 0, sizeof(config));
 
   MOCK(networkstatus_get_live_consensus,
        mock_networkstatus_get_live_consensus);





More information about the tor-commits mailing list