mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-19 13:55:41 +00:00
ext/lame/gstlame.*: Fix leak (by calling lame_init_params() before lame_close()); handle
Original commit message from CVS: Based on patch by: Roland Kay <roland.kay at ox compsoc net> * ext/lame/gstlame.c: (gst_lame_init), (gst_lame_chain), (gst_lame_setup): * ext/lame/gstlame.h: Fix leak (by calling lame_init_params() before lame_close()); handle NULL return from lame_init() more gracefully. Fixes #385311.
This commit is contained in:
parent
c51785a480
commit
bcc7663ebe
3 changed files with 42 additions and 0 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2006-12-14 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
Based on patch by: Roland Kay <roland.kay at ox compsoc net>
|
||||||
|
|
||||||
|
* ext/lame/gstlame.c: (gst_lame_init), (gst_lame_chain),
|
||||||
|
(gst_lame_setup):
|
||||||
|
* ext/lame/gstlame.h:
|
||||||
|
Fix leak (by calling lame_init_params() before lame_close()); handle
|
||||||
|
NULL return from lame_init() more gracefully. Fixes #385311.
|
||||||
|
|
||||||
2006-12-14 Jan Schmidt <thaytan@mad.scientist.com>
|
2006-12-14 Jan Schmidt <thaytan@mad.scientist.com>
|
||||||
|
|
||||||
* configure.ac:
|
* configure.ac:
|
||||||
|
|
|
@ -572,6 +572,11 @@ gst_lame_init (GstLame * lame)
|
||||||
|
|
||||||
/* create an encoder state so we can ask about defaults */
|
/* create an encoder state so we can ask about defaults */
|
||||||
lame->lgf = lame_init ();
|
lame->lgf = lame_init ();
|
||||||
|
if (lame->lgf == NULL)
|
||||||
|
goto init_error;
|
||||||
|
|
||||||
|
if (lame_init_params (lame->lgf) < 0)
|
||||||
|
goto init_error;
|
||||||
|
|
||||||
lame->samplerate = 44100;
|
lame->samplerate = 44100;
|
||||||
lame->num_channels = 2;
|
lame->num_channels = 2;
|
||||||
|
@ -623,6 +628,19 @@ gst_lame_init (GstLame * lame)
|
||||||
lame->lgf = NULL;
|
lame->lgf = NULL;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (lame, "done initializing");
|
GST_DEBUG_OBJECT (lame, "done initializing");
|
||||||
|
lame->init_error = FALSE;
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* ERRORS */
|
||||||
|
init_error:
|
||||||
|
{
|
||||||
|
GST_ERROR_OBJECT (lame, "error initializing");
|
||||||
|
lame->init_error = TRUE;
|
||||||
|
if (lame->lgf) {
|
||||||
|
lame_close (lame->lgf);
|
||||||
|
lame->lgf = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CHECK_AND_FIXUP_BITRATE(obj,pspec,rate) \
|
#define CHECK_AND_FIXUP_BITRATE(obj,pspec,rate) \
|
||||||
|
@ -974,6 +992,9 @@ gst_lame_chain (GstPad * pad, GstBuffer * buf)
|
||||||
|
|
||||||
GST_LOG_OBJECT (lame, "entered chain");
|
GST_LOG_OBJECT (lame, "entered chain");
|
||||||
|
|
||||||
|
if (lame->init_error)
|
||||||
|
goto init_error;
|
||||||
|
|
||||||
if (!lame->setup)
|
if (!lame->setup)
|
||||||
goto not_setup;
|
goto not_setup;
|
||||||
|
|
||||||
|
@ -1062,6 +1083,12 @@ not_setup:
|
||||||
("encoder not initialized (input is not audio?)"));
|
("encoder not initialized (input is not audio?)"));
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
|
init_error:
|
||||||
|
{
|
||||||
|
gst_buffer_unref (buf);
|
||||||
|
GST_ELEMENT_ERROR (lame, LIBRARY, INIT, (NULL), (NULL));
|
||||||
|
return GST_FLOW_ERROR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set up the encoder state */
|
/* set up the encoder state */
|
||||||
|
@ -1088,6 +1115,9 @@ gst_lame_setup (GstLame * lame)
|
||||||
|
|
||||||
lame->lgf = lame_init ();
|
lame->lgf = lame_init ();
|
||||||
|
|
||||||
|
if (lame->lgf == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
/* let lame choose a default samplerate */
|
/* let lame choose a default samplerate */
|
||||||
lame_set_out_samplerate (lame->lgf, 0);
|
lame_set_out_samplerate (lame->lgf, 0);
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,8 @@ struct _GstLame {
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
GstPad *srcpad, *sinkpad;
|
GstPad *srcpad, *sinkpad;
|
||||||
|
|
||||||
|
gboolean init_error; /* an error occured in the instance init function */
|
||||||
|
|
||||||
gint samplerate;
|
gint samplerate;
|
||||||
gint num_channels;
|
gint num_channels;
|
||||||
gboolean setup;
|
gboolean setup;
|
||||||
|
|
Loading…
Reference in a new issue