[vlc-devel] commit: Avoid segfault in subtitle demuxer. ( Rémi Duraffort )
rdenis at simphalempin.com
Wed Jul 2 22:49:39 CEST 2008
Le mercredi 2 juillet 2008 23:29:50 Rémi Duraffort, vous avez écrit :
> Le mercredi 02 juillet 2008 à 09:08:09, Antoine Cellerier a écrit :
> > On Wed, Jul 02, 2008, git version control wrote:
> > > psz_type = var_CreateGetString( p_demux, "sub-type" );
> > > - if( *psz_type )
> > > + if( psz_type && *psz_type )
> > I though that var_GetString always returned a string which is why we had
> > var_GetNonEmptyString. Has that behavior changed recently?
> As far as I understand the way these functions work : in case of a
> memory allocation error it will return a NULL.
> And yes it normally can't occure so I don't what to do : do we have to
> test for a NULL in case of a memory error ?
Yeah. Though on Linux, if the system runs out of memory, the process will
either be Killed, or another process will be Killed to make room. Or maybe it
will return NULL, depending on the memory over-commit settings.
Attention: running out of memory is not the same as running out of address
space. In the latter case, allocation will safely fail and return NULL.
Oh well, this is not a black and white issue.
More information about the vlc-devel