From 9c9efffd8cc32e0810b9b95cda75dcb2d7acf1f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 19 Dec 2013 16:50:10 +0000 Subject: [PATCH] udpsrc: on receive error only unmap and unref buffer if one was alloced and mapped coverity CID 1139866. --- gst/udp/gstudpsrc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gst/udp/gstudpsrc.c b/gst/udp/gstudpsrc.c index 922e381d88..c2cbd92627 100644 --- a/gst/udp/gstudpsrc.c +++ b/gst/udp/gstudpsrc.c @@ -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)) {