tests: net: tcp: Fix packet leak in recv callback
The net_context recv callback used by the test suite did not release the
net_pkt provided, causing packet leak. Since the test suite allocated
plenty of packets, it wasn't visible, however could become a problem if
more tests are added.
@@ -712,6 +712,10 @@ static void test_tcp_recv_cb(struct net_context *context,
if (status && status != -ECONNRESET) {
zassert_true(false, "failed to recv the data");
}
+
+ if (pkt) {
+ net_pkt_unref(pkt);
+ }
}
static struct net_context *accepted_ctx;
