On Wed, Dec 03, 2014 at 01:24:55AM +0100, Lukasz Marek wrote: > On 03.12.2014 01:15, Michael Niedermayer wrote: > >On Wed, Dec 03, 2014 at 12:06:47AM +0100, Lukasz Marek wrote: > >>This prevents potential crash when opt API is used without a class. > >> > >>Signed-off-by: Lukasz Marek <lukasz.m.lu...@gmail.com> > >>--- > >> libavcodec/options.c | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > >> > >>diff --git a/libavcodec/options.c b/libavcodec/options.c > >>index 7f9fb07..42ef754 100644 > >>--- a/libavcodec/options.c > >>+++ b/libavcodec/options.c > >>@@ -196,7 +196,7 @@ int avcodec_copy_context(AVCodecContext *dest, const > >>AVCodecContext *src) > >> > >> dest->priv_data = orig_priv_data; > >> > >>- if (orig_priv_data) > >>+ if (orig_priv_data && src->codec && src->codec->priv_class) > >> av_opt_copy(orig_priv_data, src->priv_data); > >> > > > >"&& src->codec->priv_class" <--- LGTM > >the src->codec check is probably ok too but is it NULL ever ? > > after avcodec_alloc_context3(NULL)? > IIRC there was a patch recently that set codec in > avcodec_alloc_context3 (via avcodec_get_context_defaults3) when > provided. Maybe after that it is not so common case. But still when > allocated with NULL then you have NULL there. src context doesn't > have to be open neither.
ok [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Its not that you shouldnt use gotos but rather that you should write readable code and code with gotos often but not always is less readable
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel