udpsrc: on receive error only unmap and unref buffer if one was alloced and mapped
authorTim-Philipp Müller <tim@centricular.com>
Thu, 19 Dec 2013 16:50:10 +0000 (16:50 +0000)
committerTim-Philipp Müller <tim@centricular.com>
Thu, 19 Dec 2013 20:35:03 +0000 (20:35 +0000)
coverity CID 1139866.

gst/udp/gstudpsrc.c

index 922e381..c2cbd92 100644 (file)
@@ -390,7 +390,7 @@ gst_udpsrc_create (GstPushSrc * psrc, GstBuffer ** buf)
 {
   GstFlowReturn ret;
   GstUDPSrc *udpsrc;
-  GstBuffer *outbuf;
+  GstBuffer *outbuf = NULL;
   GstMapInfo info;
   GSocketAddress *saddr = NULL;
   gsize offset;
@@ -555,8 +555,10 @@ alloc_failed:
   }
 receive_error:
   {
-    gst_buffer_unmap (outbuf, &info);
-    gst_buffer_unref (outbuf);
+    if (outbuf != NULL) {
+      gst_buffer_unmap (outbuf, &info);
+      gst_buffer_unref (outbuf);
+    }
 
     if (g_error_matches (err, G_IO_ERROR, G_IO_ERROR_BUSY) ||
         g_error_matches (err, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {