From cdcc9bc7cf4abaaa5d246ed6046a5a4454a6368e Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sat, 5 Feb 2005 18:35:18 +0000 Subject: [PATCH] ext/ffmpeg/gstffmpegenc.c: Only free context if it was created (otherwise it crashes). Original commit message from CVS: * ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_link): Only free context if it was created (otherwise it crashes). --- ChangeLog | 5 +++++ ext/ffmpeg/gstffmpegenc.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 164fe28..9578d8e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-02-05 Ronald S. Bultje + + * ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_link): + Only free context if it was created (otherwise it crashes). + 2005-02-04 Jan Schmidt * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_frame), diff --git a/ext/ffmpeg/gstffmpegenc.c b/ext/ffmpeg/gstffmpegenc.c index 15e8662..5a1d9de 100644 --- a/ext/ffmpeg/gstffmpegenc.c +++ b/ext/ffmpeg/gstffmpegenc.c @@ -389,7 +389,8 @@ gst_ffmpegenc_link (GstPad * pad, const GstCaps * caps) /* open codec */ if (avcodec_open (ffmpegenc->context, oclass->in_plugin) < 0) { - avcodec_close (ffmpegenc->context); + if (ffmpegenc->context->priv_data) + avcodec_close (ffmpegenc->context); GST_DEBUG ("ffenc_%s: Failed to open FFMPEG codec", oclass->in_plugin->name); return GST_PAD_LINK_REFUSED; -- 2.7.4