From 710c39687f0e3107d90e33d5bf39fdcb0ce92cb9 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sun, 1 May 2005 10:15:33 +0000 Subject: [PATCH] ext/ffmpeg/gstffmpegmux.c: Fix possible segfaults (#302017). Original commit message from CVS: * ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_class_init), (gst_ffmpegmux_finalize), (gst_ffmpegmux_loop), (gst_ffmpegmux_change_state): Fix possible segfaults (#302017). --- ChangeLog | 7 +++++++ ext/ffmpeg/gstffmpegmux.c | 18 ++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7c73473..5ae28a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-05-01 Ronald S. Bultje + + * ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_class_init), + (gst_ffmpegmux_finalize), (gst_ffmpegmux_loop), + (gst_ffmpegmux_change_state): + Fix possible segfaults (#302017). + 2005-04-25 Ronald S. Bultje * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_handle_event): diff --git a/ext/ffmpeg/gstffmpegmux.c b/ext/ffmpeg/gstffmpegmux.c index e8320cf..730179f 100644 --- a/ext/ffmpeg/gstffmpegmux.c +++ b/ext/ffmpeg/gstffmpegmux.c @@ -97,7 +97,7 @@ static GHashTable *global_plugins; static void gst_ffmpegmux_class_init (GstFFMpegMuxClass * klass); static void gst_ffmpegmux_base_init (GstFFMpegMuxClass * klass); static void gst_ffmpegmux_init (GstFFMpegMux * ffmpegmux); -static void gst_ffmpegmux_dispose (GObject * object); +static void gst_ffmpegmux_finalize (GObject * object); static GstPadLinkReturn gst_ffmpegmux_connect (GstPad * pad, const GstCaps * caps); @@ -167,7 +167,7 @@ gst_ffmpegmux_class_init (GstFFMpegMuxClass * klass) gstelement_class->request_new_pad = gst_ffmpegmux_request_new_pad; gstelement_class->change_state = gst_ffmpegmux_change_state; - gobject_class->dispose = gst_ffmpegmux_dispose; + gobject_class->finalize = gst_ffmpegmux_finalize; } static void @@ -196,16 +196,14 @@ gst_ffmpegmux_init (GstFFMpegMux * ffmpegmux) } static void -gst_ffmpegmux_dispose (GObject * object) +gst_ffmpegmux_finalize (GObject * object) { GstFFMpegMux *ffmpegmux = (GstFFMpegMux *) object; - if (ffmpegmux->opened) { - url_fclose (&ffmpegmux->context->pb); - ffmpegmux->opened = FALSE; - } - g_free (ffmpegmux->context); + + if (G_OBJECT_CLASS (parent_class)->finalize) + G_OBJECT_CLASS (parent_class)->finalize (object); } static GstPad * @@ -488,8 +486,8 @@ gst_ffmpegmux_loop (GstElement * element) } else { /* close down */ av_write_trailer (ffmpegmux->context); - url_fclose (&ffmpegmux->context->pb); ffmpegmux->opened = FALSE; + url_fclose (&ffmpegmux->context->pb); gst_element_set_eos (element); } } @@ -507,8 +505,8 @@ gst_ffmpegmux_change_state (GstElement * element) ffmpegmux->tags = NULL; } if (ffmpegmux->opened) { - url_fclose (&ffmpegmux->context->pb); ffmpegmux->opened = FALSE; + url_fclose (&ffmpegmux->context->pb); } break; } -- 2.7.4