[vlc-devel] [VLC] #2366: realloc is generally used incorrectly

Laurent Aimar fenrir at via.ecp.fr
Tue May 26 10:06:25 CEST 2009


Hi,

On Tue, May 26, 2009, Rémi Denis-Courmont wrote:
> 
> On Tue, 26 May 2009 00:34:02 +0200, Laurent Aimar <fenrir at via.ecp.fr>
> wrote:
> >  I think simply returning from the function without releasing anything
> > that is
> > just memory will simplify a lot and is easy to be safe. Yes, when not
> > enough
> > memory (and is detected) we will loose a bit more but better that than a
> > crash/security risk and might be a good compromise. abort() could be
> > reserved
> > for cases where some states are corrupted and not recovered
> 
> I find it very ironic that we would knowingly leak memory in so-called OOM
> situation...
 Yes, but doomed for doomed...

> But anyway, that won't work - the caller will often assume the data was
> stored successfully in the table, and who knows what it's going to do. In
> some cases, it will just leak. In other cases, it will cause corruption.
 Then that's a case where a state is corrupted, an abort() seems fine then.

 Anyway, I do agree that forking for input would be the best way to cope (ie with
an abort), but I fear a bit the complexity/overhead of such a solution with the
current code.

-- 
fenrir




More information about the vlc-devel mailing list