mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-03 16:09:39 +00:00
rtptheoradepay: Fix memory leaks
The same memory leaks were fixed in identical fashion for
vorbisdepay in 06efeff5d9
in 2009.
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=755277
This commit is contained in:
parent
2d7bfc1314
commit
905295ea34
1 changed files with 55 additions and 0 deletions
|
@ -74,6 +74,9 @@ static gboolean gst_rtp_theora_depay_packet_lost (GstRTPBaseDepayload *
|
||||||
|
|
||||||
static void gst_rtp_theora_depay_finalize (GObject * object);
|
static void gst_rtp_theora_depay_finalize (GObject * object);
|
||||||
|
|
||||||
|
static GstStateChangeReturn gst_rtp_theora_depay_change_state (GstElement *
|
||||||
|
element, GstStateChange transition);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_rtp_theora_depay_class_init (GstRtpTheoraDepayClass * klass)
|
gst_rtp_theora_depay_class_init (GstRtpTheoraDepayClass * klass)
|
||||||
{
|
{
|
||||||
|
@ -87,6 +90,8 @@ gst_rtp_theora_depay_class_init (GstRtpTheoraDepayClass * klass)
|
||||||
|
|
||||||
gobject_class->finalize = gst_rtp_theora_depay_finalize;
|
gobject_class->finalize = gst_rtp_theora_depay_finalize;
|
||||||
|
|
||||||
|
gstelement_class->change_state = gst_rtp_theora_depay_change_state;
|
||||||
|
|
||||||
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_theora_depay_process;
|
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_theora_depay_process;
|
||||||
gstrtpbasedepayload_class->set_caps = gst_rtp_theora_depay_setcaps;
|
gstrtpbasedepayload_class->set_caps = gst_rtp_theora_depay_setcaps;
|
||||||
gstrtpbasedepayload_class->packet_lost = gst_rtp_theora_depay_packet_lost;
|
gstrtpbasedepayload_class->packet_lost = gst_rtp_theora_depay_packet_lost;
|
||||||
|
@ -111,6 +116,20 @@ gst_rtp_theora_depay_init (GstRtpTheoraDepay * rtptheoradepay)
|
||||||
rtptheoradepay->adapter = gst_adapter_new ();
|
rtptheoradepay->adapter = gst_adapter_new ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
free_config (GstRtpTheoraConfig * config)
|
||||||
|
{
|
||||||
|
g_list_free_full (config->headers, (GDestroyNotify) gst_buffer_unref);
|
||||||
|
g_free (config);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
free_indents (GstRtpTheoraDepay * rtptheoradepay)
|
||||||
|
{
|
||||||
|
g_list_free_full (rtptheoradepay->configs, (GDestroyNotify) free_config);
|
||||||
|
rtptheoradepay->configs = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_rtp_theora_depay_finalize (GObject * object)
|
gst_rtp_theora_depay_finalize (GObject * object)
|
||||||
{
|
{
|
||||||
|
@ -244,6 +263,7 @@ gst_rtp_theora_depay_parse_configuration (GstRtpTheoraDepay * rtptheoradepay,
|
||||||
h_size = h_sizes[j];
|
h_size = h_sizes[j];
|
||||||
if (size < h_size) {
|
if (size < h_size) {
|
||||||
if (j != n_headers || size + extra != h_size) {
|
if (j != n_headers || size + extra != h_size) {
|
||||||
|
free_config (conf);
|
||||||
goto too_small;
|
goto too_small;
|
||||||
} else {
|
} else {
|
||||||
/* otherwise means that overall length field contained total length,
|
/* otherwise means that overall length field contained total length,
|
||||||
|
@ -266,6 +286,8 @@ gst_rtp_theora_depay_parse_configuration (GstRtpTheoraDepay * rtptheoradepay,
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_buffer_unmap (confbuf, &map);
|
gst_buffer_unmap (confbuf, &map);
|
||||||
|
gst_buffer_unref (confbuf);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
@ -273,6 +295,7 @@ too_small:
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (rtptheoradepay, "configuration too small");
|
GST_DEBUG_OBJECT (rtptheoradepay, "configuration too small");
|
||||||
gst_buffer_unmap (confbuf, &map);
|
gst_buffer_unmap (confbuf, &map);
|
||||||
|
gst_buffer_unref (confbuf);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -625,6 +648,38 @@ request_keyframe:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GstStateChangeReturn
|
||||||
|
gst_rtp_theora_depay_change_state (GstElement * element,
|
||||||
|
GstStateChange transition)
|
||||||
|
{
|
||||||
|
GstRtpTheoraDepay *rtptheoradepay;
|
||||||
|
GstStateChangeReturn ret;
|
||||||
|
|
||||||
|
rtptheoradepay = GST_RTP_THEORA_DEPAY (element);
|
||||||
|
|
||||||
|
switch (transition) {
|
||||||
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
||||||
|
break;
|
||||||
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
||||||
|
|
||||||
|
switch (transition) {
|
||||||
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||||
|
free_indents (rtptheoradepay);
|
||||||
|
break;
|
||||||
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_rtp_theora_depay_plugin_init (GstPlugin * plugin)
|
gst_rtp_theora_depay_plugin_init (GstPlugin * plugin)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue