v4l2sink: Protect against NULL-pointer access
authorIOhannes m zmölnig <zmoelnig@iem.at>
Thu, 30 Sep 2010 13:28:23 +0000 (15:28 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Sun, 10 Oct 2010 09:23:39 +0000 (11:23 +0200)
gst_v4l2sink_change_state() would free the pool without checking whether there
was a valid pool...

sys/v4l2/gstv4l2sink.c

index 679f7e2..7dc1382 100644 (file)
@@ -461,7 +461,8 @@ gst_v4l2sink_change_state (GstElement * element, GstStateChange transition)
       }
       break;
     case GST_STATE_CHANGE_READY_TO_NULL:
-      gst_v4l2_buffer_pool_destroy (v4l2sink->pool);
+      if (NULL != v4l2sink->pool)
+        gst_v4l2_buffer_pool_destroy (v4l2sink->pool);
       v4l2sink->pool = NULL;
       /* close the device */
       if (!gst_v4l2_object_stop (v4l2sink->v4l2object))