udpsrc: on receive error only unmap and unref buffer if one was alloced and mapped

coverity CID 1139866.
This commit is contained in:
Tim-Philipp Müller 2013-12-19 16:50:10 +00:00
parent 627109ce4d
commit 9c9efffd8c

View file

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