From 7e38cb9eb03d3bd973fb19455512107ebf94f294 Mon Sep 17 00:00:00 2001 From: Marvin Klimke Date: Sun, 16 Dec 2018 11:47:33 +0100 Subject: [PATCH] add free and mem_deref to prevent memory leaks --- lib/nodes/rtp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/nodes/rtp.c b/lib/nodes/rtp.c index 38d76c2d2..5e448f74a 100644 --- a/lib/nodes/rtp.c +++ b/lib/nodes/rtp.c @@ -127,8 +127,9 @@ static void rtp_handler(const struct sa *src, const struct rtp_header *hdr, stru if (queue_push(&r->recv_queue, (void *) mbuf_alloc_ref(mb)) != 1) warn("Failed to push to queue"); - /* header not yet used */ - (void)hdr; + /* source, header not yet used */ + (void) src; + (void) hdr; } int rtp_start(struct node *n) @@ -236,6 +237,7 @@ int rtp_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *rele if (ret < 0) warn("Received invalid packet from node %s: reason=%d", node_name(n), ret); + free(buf); return ret; } @@ -297,6 +299,7 @@ retry: cnt = io_sprint(&r->io, buf, buflen, &wbytes, smps, cnt); } out: free(buf); + mem_deref(mb); return cnt; }