gst-plugins-bad: camerabin2: don't leak element name strings
Tim Müller
tpm at kemper.freedesktop.org
Fri Mar 11 02:42:37 PST 2011
Module: gst-plugins-bad
Branch: master
Commit: 90c96fc17be119f851409fc4b8604648e7328d8c
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=90c96fc17be119f851409fc4b8604648e7328d8c
Author: Tim-Philipp Müller <tim.muller at collabora.co.uk>
Date: Fri Mar 11 10:34:23 2011 +0000
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 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/gst/camerabin2/gstcamerabin2.c b/gst/camerabin2/gstcamerabin2.c
index c52e2c2..b8c32a5 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);
+ }
}
}
More information about the gstreamer-commits
mailing list