From 4e8562c1f1cf5ee134043747feea093ded469be4 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Fri, 28 Aug 2009 15:16:52 +0300 Subject: raop: Fix memory leak The return memory of the pa_strbuf_tostring_free() should be freed. pa_headerlist_puts() saves its own copy. --- src/modules/rtp/rtsp_client.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/modules/rtp/rtsp_client.c') diff --git a/src/modules/rtp/rtsp_client.c b/src/modules/rtp/rtsp_client.c index 72d304e8..ba657f74 100644 --- a/src/modules/rtp/rtsp_client.c +++ b/src/modules/rtp/rtsp_client.c @@ -214,11 +214,13 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) { /* End of headers */ /* We will have a header left from our looping iteration, so add it in :) */ if (c->last_header) { + char *tmp = pa_strbuf_tostring_free(c->header_buffer); /* This is not a continuation header so let's dump it into our proplist */ - pa_headerlist_puts(c->response_headers, c->last_header, pa_strbuf_tostring_free(c->header_buffer)); + pa_headerlist_puts(c->response_headers, c->last_header, tmp); + pa_xfree(tmp); pa_xfree(c->last_header); c->last_header = NULL; - c->header_buffer= NULL; + c->header_buffer = NULL; } pa_log_debug("Full response received. Dispatching"); @@ -240,9 +242,11 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) { } if (c->last_header) { + char *tmp = pa_strbuf_tostring_free(c->header_buffer); /* This is not a continuation header so let's dump the full header/value into our proplist */ - pa_headerlist_puts(c->response_headers, c->last_header, pa_strbuf_tostring_free(c->header_buffer)); + pa_headerlist_puts(c->response_headers, c->last_header, tmp); + pa_xfree(tmp); pa_xfree(c->last_header); c->last_header = NULL; c->header_buffer = NULL; -- cgit From f3be47f1e03b5970281527d95c7ee26de2fc6dde Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 8 Sep 2009 23:49:10 +0200 Subject: rtsp: document that rtsp_exec() needs fixing (llvm-clang-analyzer) --- src/modules/rtp/rtsp_client.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/modules/rtp/rtsp_client.c') diff --git a/src/modules/rtp/rtsp_client.c b/src/modules/rtp/rtsp_client.c index ba657f74..915c1072 100644 --- a/src/modules/rtp/rtsp_client.c +++ b/src/modules/rtp/rtsp_client.c @@ -456,6 +456,8 @@ static int rtsp_exec(pa_rtsp_client* c, const char* cmd, l = pa_iochannel_write(c->io, hdrs, strlen(hdrs)); pa_xfree(hdrs); + /* FIXME: this is broken, not necessarily all bytes are written */ + return 0; } -- cgit