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

Rémi Denis-Courmont remi at remlab.net
Tue May 26 09:05:06 CEST 2009

On Tue, 26 May 2009 00:34:02 +0200, Laurent Aimar <fenrir at via.ecp.fr>
>  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

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.
>From the security standpoint, that would be worse than what we currently do
(which is to say *NULL and reliable SIGSEGV).

Rémi Denis-Courmont

More information about the vlc-devel mailing list