[vlc-devel] commit: Fix memory leak (CID 92) ( Rémi Denis-Courmont )

Pierre d'Herbemont pdherbemont at free.fr
Mon Jun 2 21:32:32 CEST 2008

On Jun 2, 2008, at 1:01 PM, Marnik Vander Elst wrote:

> Might be a silly question, but why the goto instead of just freeing  
> before the return NULL (in each block)? I know code duplication  
> isn't a good idea, but neither is goto afaik. Please enlighten me :)

goto is way better than code duplication in that case (that should be  
obvious here!). "goto error" is a clean and widely used convention.

What you do fear with goto, is un-understandable/unmaintanable/error- 
prone code. It's not the case here.


More information about the vlc-devel mailing list