summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2014-07-09 14:23:01 (GMT)
committerNirbheek Chauhan <nirbheek@centricular.com>2014-07-09 14:24:15 (GMT)
commit195cca6063f05bd4657773ef78d0517c1c19ac60 (patch)
treebfcf5a1d2bac353f7c25193de6f0d62ad6212ca9 /src
parentc29edc61afd14a6b59da7ba5c5c9f9fd54d1d397 (diff)
downloadsoup-transcoding-proxy-195cca6063f05bd4657773ef78d0517c1c19ac60.zip
soup-transcoding-proxy-195cca6063f05bd4657773ef78d0517c1c19ac60.tar.gz
Fix unref and frees in various places
Diffstat (limited to 'src')
-rw-r--r--src/encode.c6
-rw-r--r--src/lib.c19
2 files changed, 6 insertions, 19 deletions
diff --git a/src/encode.c b/src/encode.c
index a149219..62f0a71 100644
--- a/src/encode.c
+++ b/src/encode.c
@@ -23,7 +23,8 @@ on_autoplug_continue (GstElement *decodebin,
else
ret = TRUE, g_debug ("encodebin cannot passthrough %s\n", name);
- gst_object_unref (sinkpad);
+ if (sinkpad)
+ gst_object_unref (sinkpad);
g_free (name);
return ret;
}
@@ -65,7 +66,8 @@ on_decodebin_pad_added (GstElement *decodebin,
out:
g_free (name);
gst_caps_unref (caps);
- gst_object_unref (sinkpad);
+ if (sinkpad)
+ gst_object_unref (sinkpad);
return;
}
diff --git a/src/lib.c b/src/lib.c
index fc21cde..cb24fa6 100644
--- a/src/lib.c
+++ b/src/lib.c
@@ -42,9 +42,7 @@ stp_cleanup_transcode_server_ctx (TranscodeServerCtx *ctx)
{
g_print (">>> Doing server cleanup\n");
- /* Closing the stream should send a HUP on the fd and
- * trigger cleanup in write_get_response_body_chunk() */
- g_list_foreach (ctx->clients, (GFunc)stp_close_client_ctx, NULL);
+ g_list_foreach (ctx->clients, (GFunc)stp_cleanup_transcode_client_ctx, NULL);
g_list_free (ctx->clients);
/* Cleanup gstreamer pipeline */
@@ -92,10 +90,7 @@ stp_cleanup_transcode_client_ctx (TranscodeClientCtx *ctx)
g_print (">>> Doing client cleanup.");
- /* If we're cleaning up because the server is shutting down,
- * this will be NULL */
- if (server_ctx)
- server_ctx->clients = g_list_remove (server_ctx->clients, ctx);
+ server_ctx->clients = g_list_remove (server_ctx->clients, ctx);
/* Block sinkpad and srcpad, then unlink and remove */
srcpad = gst_pad_get_peer (ctx->ghostsinkpad);
@@ -107,16 +102,6 @@ stp_cleanup_transcode_client_ctx (TranscodeClientCtx *ctx)
g_print (".");
}
-void
-stp_close_client_ctx (TranscodeClientCtx *ctx)
-{
- g_print (">>> Doing client cleanup\n");
-
- ctx->server_ctx = NULL;
-
- g_free (ctx);
-}
-
/* Returns a copy of the streamheader GstBuffer */
GstBuffer*
stp_get_streamheader_from_caps (GstCaps *caps)