[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] test: Missing tor_free() in metrics unit tests
commit 2edda444da8d66cbbe86af3c97352ab9b89d651d
Author: David Goulet <dgoulet@xxxxxxxxxxxxxx>
Date: Wed Oct 28 08:52:02 2020 -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@xxxxxxxxxxxxxx>
---
src/test/test_metrics.c | 1 +
1 file changed, 1 insertion(+)
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];
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits