webrtc: Unmap all non-binary buffers received via the datachannel
authorSebastian Dröge <sebastian@centricular.com>
Tue, 7 Jan 2020 18:17:12 +0000 (20:17 +0200)
committerSebastian Dröge <slomo@coaxion.net>
Tue, 7 Jan 2020 21:15:20 +0000 (21:15 +0000)
Previously they were only unmapped in case of binary data, causing all
of them to be leaked.

ext/webrtc/webrtcdatachannel.c

index 139ec7a..c8332ac 100644 (file)
@@ -616,6 +616,7 @@ _data_channel_have_sample (GstWebRTCDataChannel * channel, GstSample * sample,
         ret = GST_FLOW_ERROR;
       } else {
         ret = _parse_control_packet (channel, info.data, info.size, error);
+        gst_buffer_unmap (buffer, &info);
       }
       break;
     }
@@ -631,6 +632,7 @@ _data_channel_have_sample (GstWebRTCDataChannel * channel, GstSample * sample,
         gchar *str = g_strndup ((gchar *) info.data, info.size);
         _channel_enqueue_task (channel, (ChannelTask) _emit_have_string, str,
             g_free);
+        gst_buffer_unmap (buffer, &info);
       }
       break;
     }