[vlc-devel] [PATCH] adjust: fix double free on unsupported chroma

Tristan Matthews tmatth at videolan.org
Thu Mar 5 15:15:56 CET 2020


On Thu, Mar 5, 2020 at 3:58 AM Steve Lhomme <robux4 at ycbcr.xyz> wrote:
>
> Looks OK.
>
> In general it may be better to automatically free the module resources
> if it fails to load. It might be done in some case but not all. If you
> have a double free then the resource was already released elsewhere
> automatically so you don't have to do it here at all.

Yeah that wasn't really clear to me, most code calling vlc_obj_malloc
doesn't bother calling vlc_obj_free on error save a few exceptions.

Best,
-t

>
> On 2020-03-04 22:02, Tristan Matthews wrote:
> > Regression since:
> >
> > commit 4316cfda13ff87f5d579f5562def1bc4e24f9731
> > Author: RĂ©mi Denis-Courmont <remi at remlab.net>
> > Date:   Wed Feb 26 20:44:13 2020 +0200
> >
> >      adjust: use vlc_obj_malloc()
> > ---
> >   modules/video_filter/adjust.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/modules/video_filter/adjust.c b/modules/video_filter/adjust.c
> > index c48d9b5ec3..35b061b855 100644
> > --- a/modules/video_filter/adjust.c
> > +++ b/modules/video_filter/adjust.c
> > @@ -189,7 +189,7 @@ static int Create( vlc_object_t *p_this )
> >           default:
> >               msg_Dbg( p_filter, "Unsupported input chroma (%4.4s)",
> >                        (char*)&(p_filter->fmt_in.video.i_chroma) );
> > -            free(p_sys);
> > +            vlc_obj_free( p_this, p_sys );
> >               return VLC_EGENERIC;
> >       }
> >
> > --
> > 2.20.1
> >
> > _______________________________________________
> > vlc-devel mailing list
> > To unsubscribe or modify your subscription options:
> > https://mailman.videolan.org/listinfo/vlc-devel
> >
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list