[vlc-devel] commit: Introduce realloc_or_free() to src/*, and add assert() to mark unhandled ENOMEM error conditions. Allocation shrinking or otherwise handled allocations don' t need realloc_or_free. (JP Dinger )

jpd at videolan.org jpd at videolan.org
Sun Dec 6 10:13:03 CET 2009


(And the other two replies where you asserted the same thing.)
On Sun, Dec 06, 2009 at 09:32:02AM +0200, R?mi Denis-Courmont wrote:
> Le samedi 5 d?cembre 2009 23:35:16 git version control, vous avez ?crit :
> > vlc | branch: master | JP Dinger <jpd at videolan.org> | [...]
> > Introduce realloc_or_free() to src/*, and add assert() to mark unhandled
> >  ENOMEM error conditions. Allocation shrinking or otherwise handled
> >  allocations don't need realloc_or_free.
> 
> I think this is wrong. You are mixing up assertions with errors.

I think you're mis-interpreting this. I do not pretend to have handled
these errors. All I did was mark them as unhandled by making explicit
the already existing assumption the call would not fail.

Reasons: 1) At least debug builds will show clearly what went wrong,
instead of crashing on a null-deref. Non-debug builds will be
unaffected. 2) Reading the code will now clearly show the previously
implicit assumption that {re,m}alloc() will not fail. 3) When we do
figure out what to do with the errors, we can more easily find them.

It's not a full solution, but not wrong either. The commit message
already warned that I did this only to mark these unhandled errors.




More information about the vlc-devel mailing list