rtspconnection: Fix GError set over the top of a previous GError
authorKristofer Bjorkstrom <kristofb@axis.com>
Mon, 18 Feb 2019 14:24:18 +0000 (15:24 +0100)
committerSebastian Dröge <slomo@coaxion.net>
Mon, 18 Feb 2019 16:12:58 +0000 (16:12 +0000)
The function fill_bytes could sometimes return a value greater than zero
and in the same time set the GError.

Function read_bytes calls fill_bytes in a while loop. In the special
case above it would call fill_bytes with error already set.
Thus resulting in "GError set over the top of a previous GError".

Solved this by clearing GError when return value is greater than zero.
Actions are taken depending on error type by caller of read_bytes. Eg.
with EWOULDBLOCK gst_rtsp_source_dispatch_read will try to read the
missing bytes again (GST_RTSP_EINTR )

https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/445

gst-libs/gst/rtsp/gstrtspconnection.c

index cb48cab..a6755be 100644 (file)
@@ -1421,8 +1421,12 @@ fill_bytes (GstRTSPConnection * conn, guint8 * buffer, guint size,
       /* try to read more bytes */
       r = fill_raw_bytes (conn, in, sizeof (in), block, err);
       if (r <= 0) {
-        if (out == 0)
+        if (out == 0) {
           out = r;
+        } else {
+          /* we have some data ignore error */
+          g_clear_error (err);
+        }
         break;
       }