From 868984b414120a49a3703a7017e32fa3666a035d Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Tue, 2 May 2006 18:15:25 +0000 Subject: [PATCH] gst/playback/: free cpas using gst_caps_unref, don't leak caps-strings Original commit message from CVS: * gst/playback/gstplaybin.c: (add_sink): * gst/playback/test.c: (main): * gst/playback/test5.c: (dump_element_stats): * gst/playback/test6.c: (main): free cpas using gst_caps_unref, don't leak caps-strings --- ChangeLog | 8 ++++++++ gst/playback/gstplaybin.c | 4 ++-- gst/playback/test.c | 5 ++++- gst/playback/test5.c | 1 + gst/playback/test6.c | 1 + 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index ec57f1f037..29e60ed115 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-05-02 Stefan Kost + + * gst/playback/gstplaybin.c: (add_sink): + * gst/playback/test.c: (main): + * gst/playback/test5.c: (dump_element_stats): + * gst/playback/test6.c: (main): + free cpas using gst_caps_unref, don't leak caps-strings + 2006-05-01 Tim-Philipp Müller * gst/typefind/gsttypefindfunctions.c: (musepack_type_find), diff --git a/gst/playback/gstplaybin.c b/gst/playback/gstplaybin.c index 9ac43e8ba7..33260c03e7 100644 --- a/gst/playback/gstplaybin.c +++ b/gst/playback/gstplaybin.c @@ -1109,7 +1109,7 @@ link_failed: GST_DEBUG_OBJECT (play_bin, "link failed when adding sink, caps %s, reason %d", capsstr, linkres); g_free (capsstr); - g_free (caps); + gst_caps_unref (caps); gst_element_set_state (sink, GST_STATE_NULL); gst_bin_remove (GST_BIN (play_bin), sink); @@ -1127,7 +1127,7 @@ subtitle_failed: "subtitle link failed when adding sink, caps %s, reason %d", capsstr, linkres); g_free (capsstr); - g_free (caps); + gst_caps_unref (caps); return TRUE; } diff --git a/gst/playback/test.c b/gst/playback/test.c index 321684b3a6..31df5827df 100644 --- a/gst/playback/test.c +++ b/gst/playback/test.c @@ -115,11 +115,14 @@ main (gint argc, gchar * argv[]) sinkpad = gst_element_get_pad (sink, "sink"); res = gst_pad_link (srcpad, sinkpad); if (!res) { + GstCaps *caps; gchar *capsstr; - capsstr = gst_caps_to_string (gst_pad_get_caps (srcpad)); + caps = gst_pad_get_caps (srcpad); + capsstr = gst_caps_to_string (caps); g_warning ("could not link %s", capsstr); g_free (capsstr); + gst_caps_unref (caps); } //g_signal_emit_by_name (G_OBJECT (player), "link_stream", obj, sinkpad); } diff --git a/gst/playback/test5.c b/gst/playback/test5.c index 44e7a01f55..96f197ffab 100644 --- a/gst/playback/test5.c +++ b/gst/playback/test5.c @@ -68,6 +68,7 @@ dump_element_stats (GstElement * element) str = gst_caps_to_string (caps); g_print (" caps: %s\n", str); g_free (str); + gst_caps_unref (caps); query = gst_query_new_duration (GST_FORMAT_TIME); if (gst_pad_query (pad, query)) { diff --git a/gst/playback/test6.c b/gst/playback/test6.c index b6ac243342..9942d0b3e5 100644 --- a/gst/playback/test6.c +++ b/gst/playback/test6.c @@ -137,6 +137,7 @@ main (gint argc, gchar * argv[]) str = gst_caps_to_string (caps); g_print (" caps: %s\n", str); g_free (str); + gst_caps_unref (caps); query = gst_query_new_duration (GST_FORMAT_TIME); if (gst_pad_query (pad, query)) {