tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

commit 2edda444da8d66cbbe86af3c97352ab9b89d651d
parent 362229f184c92712ee5a3027ce5d29024ca5b382
Author: David Goulet <dgoulet@torproject.org>
Date:   Wed, 28 Oct 2020 08:52:02 -0400

test: Missing tor_free() in metrics unit tests

Found by coverity:

  *** CID 1468664:  Resource leaks  (RESOURCE_LEAK)
  /src/test/test_metrics.c: 83 in test_config()
  77       tt_int_op(ret, OP_EQ, false);
  78
  79      done:
  80       SMARTLIST_FOREACH(ports, port_cfg_t *, c, port_cfg_free(c));
  81       smartlist_free(ports);
  82       or_options_free(options);
  >>>     CID 1468664:  Resource leaks  (RESOURCE_LEAK)
  >>>     Variable "err_msg" going out of scope leaks the storage it points to.
  83     }
  84
  85     static char _c_buf[256];
  86     #define CONTAINS(conn, msg) \
  87       do { \
  88         tt_int_op(buf_datalen(conn->outbuf), OP_EQ, (strlen(msg))); \

Signed-off-by: David Goulet <dgoulet@torproject.org>

Diffstat:
Msrc/test/test_metrics.c | 1+
1 file changed, 1 insertion(+), 0 deletions(-)

diff --git a/src/test/test_metrics.c b/src/test/test_metrics.c @@ -80,6 +80,7 @@ test_config(void *arg) SMARTLIST_FOREACH(ports, port_cfg_t *, c, port_cfg_free(c)); smartlist_free(ports); or_options_free(options); + tor_free(err_msg); } static char _c_buf[256];