From 90c96fc17be119f851409fc4b8604648e7328d8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 11 Mar 2011 10:34:23 +0000 Subject: [PATCH] camerabin2: don't leak element name strings Don't leak string copy returned by gst_element_get_name(). Also, check for certain elements by checking the plugin feature / factory name, not the assigned object name. --- gst/camerabin2/gstcamerabin2.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gst/camerabin2/gstcamerabin2.c b/gst/camerabin2/gstcamerabin2.c index c52e2c2296..b8c32a5370 100644 --- a/gst/camerabin2/gstcamerabin2.c +++ b/gst/camerabin2/gstcamerabin2.c @@ -682,9 +682,13 @@ static void encodebin_element_added (GstElement * encodebin, GstElement * new_element, GstCameraBin * camera) { - if (g_str_has_prefix (gst_element_get_name (new_element), "audiorate") || - g_str_has_prefix (gst_element_get_name (new_element), "videorate")) { - g_object_set (new_element, "skip-to-first", TRUE, NULL); + GstElementFactory *factory = gst_element_get_factory (new_element); + + if (factory != NULL) { + if (strcmp (GST_PLUGIN_FEATURE_NAME (factory), "audiorate") == 0 || + strcmp (GST_PLUGIN_FEATURE_NAME (factory), "videorate") == 0) { + g_object_set (new_element, "skip-to-first", TRUE, NULL); + } } }