From 8bfe8b28447fbbf8ff1cc4b1fec11bb92af6ef14 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Fri, 29 May 2015 01:47:39 +0530 Subject: main.c: Fix double-free The cleanup will be called when the pipeline goes EOS, so don't do it twice --- src/main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main.c b/src/main.c index 715fd8b..420490c 100644 --- a/src/main.c +++ b/src/main.c @@ -171,8 +171,6 @@ stp_abort_server_ctx (STPServerCtx *ctx) soup_message_set_status (ctx->msg, SOUP_STATUS_GONE); } stream_finished_cb (ctx->msg, ctx); - /* Disconnect all clients, and shut down the stream */ - invoke_g_hash_table_remove (ctx); } /* If it's been more than 5 seconds since the last time we got @@ -310,7 +308,7 @@ stream_finished_cb (SoupMessage *msg, } ctx->status = STP_STATUS_FLUSHING; - /* Incoming stream has ended */ + /* Incoming stream has ended; this EOS will trigger a cleanup of ctx as well */ g_signal_emit_by_name (ctx->appsrc, "end-of-stream", &ret); if (ret != GST_FLOW_OK) g_critical ("\nUnable to emit end-of-stream after an aborted stream"); @@ -713,9 +711,9 @@ PUT: { * of the previous one, so it's a conflict... unless the * '--conflict-is-restart' option has been specified. */ if (conflict_is_restart) { + g_debug ("A connection already exists; forcing a restart"); ctx = get_server_ctx_from_msg (msg, tables->ctxs); stream_finished_cb (ctx->msg, ctx); - invoke_g_hash_table_remove (ctx); goto new_conn; } g_critical ("Recv Content-Length PUT on '%s' without Content-Range", path); -- cgit v0.11.2-2-gd1dd