media: Fix a NULL pointer deref crash, and add diagnostic logging.

Thu, 12 May 2011 01:21:50 +0000

author
Paul Aurich <darkrain42@pidgin.im>
date
Thu, 12 May 2011 01:21:50 +0000
changeset 31807
ea1e6ba109cc
parent 31806
c9a9c04947a4
child 31808
40248c682723
child 31810
a4ba91b66fd1

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

libpurple/media/backend-fs2.c file | annotate | diff | comparison | revisions
--- 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;

mercurial