mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 03:19:40 +00:00
lame: Avoid crash when seeking before negotiating
lame's 'lgv' variable is only initialized when the caps is negotiated, whenever a seek happens before that, it would attempt to call a function on an empty pointer, causing the crash. Fixes #603515
This commit is contained in:
parent
21177487d9
commit
82ab87032d
2 changed files with 14 additions and 10 deletions
|
@ -1024,11 +1024,13 @@ gst_lame_sink_event (GstPad * pad, GstEvent * event)
|
|||
|
||||
GST_DEBUG_OBJECT (lame, "handling FLUSH stop event");
|
||||
|
||||
/* clear buffers */
|
||||
mp3_buffer_size = 7200;
|
||||
mp3_data = g_malloc (mp3_buffer_size);
|
||||
lame_encode_flush (lame->lgf, mp3_data, mp3_buffer_size);
|
||||
g_free (mp3_data);
|
||||
if (lame->lgf) {
|
||||
/* clear buffers if we already have lame set up */
|
||||
mp3_buffer_size = 7200;
|
||||
mp3_data = g_malloc (mp3_buffer_size);
|
||||
lame_encode_flush (lame->lgf, mp3_data, mp3_buffer_size);
|
||||
g_free (mp3_data);
|
||||
}
|
||||
|
||||
ret = gst_pad_push_event (lame->srcpad, event);
|
||||
break;
|
||||
|
|
|
@ -586,11 +586,13 @@ gst_lamemp3enc_sink_event (GstPad * pad, GstEvent * event)
|
|||
|
||||
GST_DEBUG_OBJECT (lame, "handling FLUSH stop event");
|
||||
|
||||
/* clear buffers */
|
||||
mp3_buffer_size = 7200;
|
||||
mp3_data = g_malloc (mp3_buffer_size);
|
||||
lame_encode_flush (lame->lgf, mp3_data, mp3_buffer_size);
|
||||
g_free (mp3_data);
|
||||
if (lame->lgf) {
|
||||
/* clear buffers if we already have lame set up */
|
||||
mp3_buffer_size = 7200;
|
||||
mp3_data = g_malloc (mp3_buffer_size);
|
||||
lame_encode_flush (lame->lgf, mp3_data, mp3_buffer_size);
|
||||
g_free (mp3_data);
|
||||
}
|
||||
|
||||
ret = gst_pad_push_event (lame->srcpad, event);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue