[vlc-devel] commit: record: forgotten initializations (Erwan Tulou )

brezhoneg1 brezhoneg1 at yahoo.fr
Sun Aug 30 11:16:24 CEST 2009


> > -    char *psz_output;
> > +    char *psz_file = NULL;
> > +    char *psz_output = NULL;
> >      int i_count;
> >
> >      if( asprintf( &psz_file,
> "%s%s%s",
> 
> This is incorrect. If asprintf() fails *psz_file is
> undefined, not untouched.
> 
>
You're right about pointers needing to be nullified after returning from
a failed asprintf.

Yet, in this case, they also need to be initialized to NULL, because there
are several asprintf and goto error. If not initialized, some pointers may
be freed with an undefined value.

Rgds
Erwan10


      



More information about the vlc-devel mailing list