sdpsrc: fix double free if sdp is provided as string via the property

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1532

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2025>
This commit is contained in:
Tim-Philipp Müller 2021-02-19 00:03:00 +00:00 committed by GStreamer Merge Bot
parent 8d1a79e520
commit 438449db69

View file

@ -159,8 +159,11 @@ gst_sdp_src_change_state (GstElement * element, GstStateChange transition)
if (self->location && strcmp (self->location, "sdp://") != 0) {
/* Do nothing */
} else if (self->sdp) {
guint sdp_len = strlen (self->sdp);
self->sdp_buffer =
gst_buffer_new_wrapped (self->sdp, strlen (self->sdp) + 1);
gst_buffer_new_wrapped (g_strndup (self->sdp, sdp_len),
sdp_len + 1);
} else {
ret = GST_STATE_CHANGE_FAILURE;
}