summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/modules/rtp/raop_client.c4
-rw-r--r--src/modules/rtp/rtsp_client.c8
2 files changed, 11 insertions, 1 deletions
diff --git a/src/modules/rtp/raop_client.c b/src/modules/rtp/raop_client.c
index a9b9ab1d..e5a373d0 100644
--- a/src/modules/rtp/raop_client.c
+++ b/src/modules/rtp/raop_client.c
@@ -344,6 +344,7 @@ static void rtsp_cb(pa_rtsp_client *rtsp, pa_rtsp_state state, pa_headerlist* he
case STATE_DISCONNECTED:
pa_assert(c->closed_callback);
pa_log_debug("RTSP channel closed");
+ c->rtsp = NULL;
if (c->fd > 0) {
pa_close(c->fd);
c->fd = -1;
@@ -400,7 +401,8 @@ void pa_raop_client_free(pa_raop_client* c)
pa_assert(c);
pa_xfree(c->buffer);
- pa_rtsp_client_free(c->rtsp);
+ if (c->rtsp)
+ pa_rtsp_client_free(c->rtsp);
pa_xfree(c->host);
pa_xfree(c);
}
diff --git a/src/modules/rtp/rtsp_client.c b/src/modules/rtp/rtsp_client.c
index 24839729..f9fe9bfe 100644
--- a/src/modules/rtp/rtsp_client.c
+++ b/src/modules/rtp/rtsp_client.c
@@ -151,6 +151,10 @@ 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->url);
pa_xfree(c->localip);
@@ -227,6 +231,10 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) {
pa_assert(c->callback);
if (!s) {
+ /* Keep the ioline/iochannel open as they will be freed automatically */
+ c->ioline = NULL;
+ c->io = NULL;
+ pa_rtsp_client_free(c);
c->callback(c, STATE_DISCONNECTED, NULL, c->userdata);
return;
}