mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 04:56:14 +00:00
rtmpsink: Fix leak on connection failure
Although RTMP_ConnectStream() was failed, librtmp's internal memory is not freed by RTMP_ConnectStream(), so RTMP_Close() should be called before RTMP_Free() https://bugzilla.gnome.org/show_bug.cgi?id=797058
This commit is contained in:
parent
7d79378895
commit
3bd3cc7bb0
1 changed files with 20 additions and 10 deletions
|
@ -239,17 +239,14 @@ gst_rtmp_sink_render (GstBaseSink * bsink, GstBuffer * buf)
|
||||||
if (sink->first) {
|
if (sink->first) {
|
||||||
/* open the connection */
|
/* open the connection */
|
||||||
if (!RTMP_IsConnected (sink->rtmp)) {
|
if (!RTMP_IsConnected (sink->rtmp)) {
|
||||||
if (!RTMP_Connect (sink->rtmp, NULL)
|
if (!RTMP_Connect (sink->rtmp, NULL))
|
||||||
|| !RTMP_ConnectStream (sink->rtmp, 0)) {
|
goto connection_failed;
|
||||||
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, (NULL),
|
|
||||||
("Could not connect to RTMP stream \"%s\" for writing", sink->uri));
|
if (!RTMP_ConnectStream (sink->rtmp, 0)) {
|
||||||
RTMP_Free (sink->rtmp);
|
RTMP_Close (sink->rtmp);
|
||||||
sink->rtmp = NULL;
|
goto connection_failed;
|
||||||
g_free (sink->rtmp_uri);
|
|
||||||
sink->rtmp_uri = NULL;
|
|
||||||
sink->have_write_error = TRUE;
|
|
||||||
return GST_FLOW_ERROR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (sink, "Opened connection to %s", sink->rtmp_uri);
|
GST_DEBUG_OBJECT (sink, "Opened connection to %s", sink->rtmp_uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,6 +287,19 @@ write_failed:
|
||||||
sink->have_write_error = TRUE;
|
sink->have_write_error = TRUE;
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
connection_failed:
|
||||||
|
{
|
||||||
|
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, (NULL),
|
||||||
|
("Could not connect to RTMP stream \"%s\" for writing", sink->uri));
|
||||||
|
RTMP_Free (sink->rtmp);
|
||||||
|
sink->rtmp = NULL;
|
||||||
|
g_free (sink->rtmp_uri);
|
||||||
|
sink->rtmp_uri = NULL;
|
||||||
|
sink->have_write_error = TRUE;
|
||||||
|
|
||||||
|
return GST_FLOW_ERROR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue