changeset 32053:0b73619ad581

media: Fix a NULL pointer deref crash, and add diagnostic logging. I'm not entirely sure that just short-circuiting error handling in this case is correct (in fact I suspect it's not), but it's certainly better than a crash, and now there's detail on the actual error. Closes #14033
author Paul Aurich <paul@darkrain42.org>
date Thu, 12 May 2011 01:21:50 +0000
parents bfb4b66953b4
children 7d75ffbde679 2f66104dab0c
files libpurple/media/backend-fs2.c
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/media/backend-fs2.c	Wed May 11 09:29:47 2011 +0000
+++ b/libpurple/media/backend-fs2.c	Thu May 12 01:21:50 2011 +0000
@@ -1081,6 +1081,22 @@
 	GstElement *lastElement = NULL;
 	GList *sessions;
 
+	GError *error = NULL;
+	gchar *debug_msg = NULL;
+
+	gst_message_parse_error(msg, &error, &debug_msg);
+	purple_debug_error("backend-fs2", "gst error %s\ndebugging: %s\n",
+			error->message, debug_msg);
+
+	g_error_free(error);
+	g_free(debug_msg);
+
+	/* Not entirely sure this is correct, but prevents a
+	 * NULL deref crash.
+	 */
+	if (!element)
+		return;
+
 	while (!GST_IS_PIPELINE(element)) {
 		if (element == priv->confbin)
 			break;