After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 705188 - Leaked Resource in nanohttp.c
Leaked Resource in nanohttp.c
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: general
git master
Other Linux
: Normal critical
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2013-07-31 06:52 UTC by Gaurav
Modified: 2013-09-30 02:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use same behaviour on Solaris platform as we used on other platforms (729 bytes, patch)
2013-08-06 07:11 UTC, Denis Pauk
none Details | Review

Description Gaurav 2013-07-31 06:52:19 UTC
In File:
https://git.gnome.org/browse/libxml2/tree/nanohttp.c

Lines: 1001 to 1007
    if (getsockopt(s, SOL_SOCKET, SO_ERROR, (char *) &status, &len) <
            0) {
            /* Solaris error code */
            __xmlIOErr(XML_FROM_HTTP, 0, "getsockopt failed\n");
            return INVALID_SOCKET;


This will cause memory leak as function returns and socket is still open.

Fix:
       if (getsockopt(s, SOL_SOCKET, SO_ERROR, (char *) &status, &len) <
            0) {
            /* Solaris error code */
            __xmlIOErr(XML_FROM_HTTP, 0, "getsockopt failed\n");
            closesocket(s);
            return INVALID_SOCKET;
Comment 1 Denis Pauk 2013-08-06 07:11:08 UTC
Created attachment 250923 [details] [review]
Use same behaviour on Solaris platform as we used on other platforms
Comment 2 Daniel Veillard 2013-09-30 02:55:32 UTC
Ah, indeed, that's bad, patch applied:

https://git.gnome.org/browse/libxml2/commit/?id=283c83e0d3bca73b61c1d116c05fe4ccaa96ec04

that specific piece of code is a mess, thanks Denis for providing the patch !

Daniel