[vlc-devel] Fixed TCP handle leak on failed attempt to open network stream

tom245292 at hushmail.me tom245292 at hushmail.me
Wed Jan 20 16:14:23 CET 2010


Thanks. You were right about the problem being in 
src/misc/objects.c . I believe that the leak was actually caused by 
the position of the WIN32 specific winsock code (pipe() + def 
statements) that was located BELOW vlc_object_destroy(). These 
defined the close() statement as clocksocket() for WIN32. However, 
because they are defined AFTER vlc_object_destroy(), the close() 
statements have a different meaning inside vlc_object_destroy() 
itself. Consequently closesocket() doesn't get called and the two 
pipe sockets get left open.

To fix this I've moved the definition for vlc_object_destroy to 
BELOW the WIN32 specific winsock code. This now allows 
vlc_object_destroy() to call closesocket() and thus cleans up the 

I have performed a preliminary build to confirm that this fixes the 
leak on Windows XP. I will perform more vigorous testing to ensure 
that there are no side effects later on.

As I'm completly new to VLC development, could somebody please 
check that I've got this bugfix right ?

Thanks again,


On Wed, 20 Jan 2010 12:59:44 +0000 Rémi Denis-Courmont 
<remi at remlab.net> wrote:
>----- Message d'origine -----
>> I am searching through VLC's source code to try and find where
>> these connections are left open. Any help or advice would be
>> greatly appreciated.
>For HTTP, modules/access/http.c, for RTSP 
>moduled/demux/live555.cpp and the underlying live555 library.
>> Example command line: "c:\program files\VideoLan\vlc\vlc.exe
>> rtsp:\\badURL".
>If that fails, even with an invalid domain name, it sounds more 
>like a problem in the "waitpipe" in src/misc/objects.c.

More information about the vlc-devel mailing list