[pulseaudio-discuss] [PATCH] rtp-send: fix a memory leak

Tanu Kaskinen tanuk at iki.fi
Fri May 4 14:22:58 UTC 2018


p is the return value of pa_sdp_build(), and pa_sdp_build() allocates
the return value with pa_sprintf_malloc(), so p has to be freed after
use.
---
 src/modules/rtp/module-rtp-send.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/modules/rtp/module-rtp-send.c b/src/modules/rtp/module-rtp-send.c
index ceb6df502..344463d58 100644
--- a/src/modules/rtp/module-rtp-send.c
+++ b/src/modules/rtp/module-rtp-send.c
@@ -492,6 +492,7 @@ int pa__init(pa_module*m) {
 
     pa_log_info("RTP stream initialized with mtu %u on %s:%u from %s ttl=%u, SSRC=0x%08x, payload=%u, initial sequence #%u", mtu, dst_addr, port, src_addr, ttl, u->rtp_context.ssrc, payload, u->rtp_context.sequence);
     pa_log_info("SDP-Data:\n%s\nEOF", p);
+    pa_xfree(p);
 
     pa_sap_send(&u->sap_context, 0);
 
-- 
2.17.0



More information about the pulseaudio-discuss mailing list