diff options
author | David Goulet <dgoulet@torproject.org> | 2020-10-28 08:52:02 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2020-10-28 08:52:02 -0400 |
commit | 2edda444da8d66cbbe86af3c97352ab9b89d651d (patch) | |
tree | d561f574094ce28299cf144e10a3d241135e973d /src | |
parent | 362229f184c92712ee5a3027ce5d29024ca5b382 (diff) | |
download | tor-2edda444da8d66cbbe86af3c97352ab9b89d651d.tar.gz tor-2edda444da8d66cbbe86af3c97352ab9b89d651d.zip |
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 (limited to 'src')
-rw-r--r-- | src/test/test_metrics.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/test/test_metrics.c b/src/test/test_metrics.c index 26e84a5798..1c645813a4 100644 --- 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]; |