]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
test_channel_listener: free 'chan' explicitly
authorNick Mathewson <nickm@torproject.org>
Thu, 16 May 2019 19:34:28 +0000 (15:34 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 16 May 2019 19:35:21 +0000 (15:35 -0400)
This should fix CID 1437442, where coverity can't tell that
channel_free_all() frees the fake channel we allocated.

src/test/test_channel.c

index 4c2bbc86b410b66073eff3110943dc5a7da23992..6a6bc9d810d52bebb2a975c220a8a67f7d664704 100644 (file)
@@ -1540,6 +1540,10 @@ test_channel_listener(void *arg)
   channel_listener_dump_statistics(chan, LOG_INFO);
 
  done:
+  if (chan) {
+    channel_listener_unregister(chan);
+    tor_free(chan);
+  }
   channel_free_all();
 }
 
@@ -1566,4 +1570,3 @@ struct testcase_t channel_tests[] = {
     NULL, NULL },
   END_OF_TESTCASES
 };
-