From 8a00c009439d1c559a2992b2f9f67e2708334d5a Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Sun, 1 Mar 2009 23:17:07 +0000 Subject: raop: Handle the reponse header memory allocation more sensibly. In theory the callback called after reading headers could free our whole object, so we should not take it upon ourselves to free the headers after the call to the callback. --- src/modules/rtp/rtsp_client.c | 56 +++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 29 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 9eb3d964..3b077bec 100644 --- a/src/modules/rtp/rtsp_client.c +++ b/src/modules/rtp/rtsp_client.c @@ -101,26 +101,27 @@ pa_rtsp_client* pa_rtsp_client_new(pa_mainloop_api *mainloop, const char* hostna void pa_rtsp_client_free(pa_rtsp_client* c) { - if (c) { - if (c->sc) - pa_socket_client_unref(c->sc); - if (c->ioline) - pa_ioline_close(c->ioline); - else if (c->io) - pa_iochannel_free(c->io); - - pa_xfree(c->hostname); - pa_xfree(c->url); - pa_xfree(c->localip); - pa_xfree(c->session); - pa_xfree(c->transport); - pa_xfree(c->last_header); - if (c->header_buffer) - pa_strbuf_free(c->header_buffer); - if (c->response_headers) - pa_headerlist_free(c->response_headers); - pa_headerlist_free(c->headers); - } + pa_assert(c); + + if (c->sc) + pa_socket_client_unref(c->sc); + if (c->ioline) + pa_ioline_close(c->ioline); + else if (c->io) + pa_iochannel_free(c->io); + + pa_xfree(c->hostname); + pa_xfree(c->url); + pa_xfree(c->localip); + pa_xfree(c->session); + pa_xfree(c->transport); + pa_xfree(c->last_header); + if (c->header_buffer) + pa_strbuf_free(c->header_buffer); + if (c->response_headers) + pa_headerlist_free(c->response_headers); + pa_headerlist_free(c->headers); + pa_xfree(c); } @@ -141,8 +142,6 @@ static void headers_read(pa_rtsp_client *c) { c->transport = pa_xstrdup(pa_headerlist_gets(c->response_headers, "Transport")); if (!c->session || !c->transport) { - pa_headerlist_free(c->response_headers); - c->response_headers = NULL; pa_log("Invalid SETUP response."); return; } @@ -160,8 +159,6 @@ static void headers_read(pa_rtsp_client *c) { } if (0 == c->rtp_port) { /* Error no server_port in response */ - pa_headerlist_free(c->response_headers); - c->response_headers = NULL; pa_log("Invalid SETUP response (no port number)."); return; } @@ -169,9 +166,6 @@ static void headers_read(pa_rtsp_client *c) { /* Call our callback */ c->callback(c, c->state, c->response_headers, c->userdata); - - pa_headerlist_free(c->response_headers); - c->response_headers = NULL; } @@ -201,7 +195,8 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) { } if (c->waiting && 0 == strcmp("RTSP/1.0 200 OK", s2)) { c->waiting = 0; - pa_assert(!c->response_headers); + if (c->response_headers) + pa_headerlist_free(c->response_headers); c->response_headers = pa_headerlist_new(); goto exit; } @@ -353,9 +348,12 @@ void pa_rtsp_set_callback(pa_rtsp_client *c, pa_rtsp_cb_t callback, void *userda void pa_rtsp_disconnect(pa_rtsp_client *c) { pa_assert(c); - if (c->io) + if (c->ioline) + pa_ioline_close(c->ioline); + else if (c->io) pa_iochannel_free(c->io); c->io = NULL; + c->ioline = NULL; } -- cgit From 86dee05aec330a0c2886c0327712153793ca46c4 Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Tue, 3 Mar 2009 20:23:02 +0000 Subject: Use LGPL 2.1 on all files previously using LGPL 2 --- src/modules/rtp/rtsp_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (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 3b077bec..b0b8a1e0 100644 --- a/src/modules/rtp/rtsp_client.c +++ b/src/modules/rtp/rtsp_client.c @@ -5,7 +5,7 @@ PulseAudio is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published - by the Free Software Foundation; either version 2 of the License, + by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. PulseAudio is distributed in the hope that it will be useful, but -- cgit From 0329edd1791e3c8fbed33f266d86cae6b91a5556 Mon Sep 17 00:00:00 2001 From: Finn Thain Date: Thu, 26 Feb 2009 16:48:58 +1100 Subject: revive solaris module Hi All, This patch fixes the solaris audio device source and sink, and fixes some portability issues that break the build on solaris. Questions and comments welcomed. I've tested this patch only with OpenSolaris Express snv 103. Eventually I hope to be able to test a few older releases and older hardware (though it is hard to say whether there is much interest in those). This is my first brush with pulseaudio and so I read the wiki docs and some of the source code but I'm still unsure of a few things. In particular I'm wondering about rewind processing, corking and what (if anything) the module needs for those. I'm also unclear on the implications of thread_info.buffer_size, .fragment_size and .max_request, and whether my code is correct or not. This patch disables link map/library versioning unless ld is GNU ld. Another approach for solaris would be to use that linker's -M option, but I couldn't make that work (due to undefined mainloop, browse and simple symbols when linking pacat. I can post the errors if anyone is intested.) Thanks, Finn Thain --- src/modules/rtp/rtsp_client.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (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 b0b8a1e0..98db05dd 100644 --- a/src/modules/rtp/rtsp_client.c +++ b/src/modules/rtp/rtsp_client.c @@ -43,9 +43,14 @@ #include #include #include -#include #include +#ifdef HAVE_POLL_H +#include +#else +#include +#endif + #include "rtsp_client.h" struct pa_rtsp_client { -- cgit