[gst-devel] null reference in gstwavparse.c

Conrad Cooke Conrad.Cooke at palm.com
Wed Nov 25 19:00:25 CET 2009


I was encountering a crash due to referencing a null pointer on calling gst_wavparse_pad_query () 

The pad passed in is valid but its parent is null.

In this case, the pipeline is changing state.

I 'fixed' it by simply checking the reference and returning false if null.
Is this a valid fix or am I masking some other issue?

Here is my diff:

 Index: gst/wavparse/gstwavparse.c
===================================================================
--- gst/wavparse/gstwavparse.c	(.../44)	(revision 227892)
+++ gst/wavparse/gstwavparse.c	(.../45)	(revision 227892)
@@ -2089,6 +2089,10 @@
 {
   gboolean res = TRUE;
   GstWavParse *wav = GST_WAVPARSE (gst_pad_get_parent (pad));
+  if (NULL == wav)  {
+      GST_ERROR_OBJECT (wav, "GstWavParse null reference");
+	return FALSE;
+  }




More information about the gstreamer-devel mailing list