Memory leak of 18 bytes from 1 block allocated in nsSOCKSSocketInfo::GetProxyHost

VERIFIED FIXED in mozilla1.1beta

Status

()

Core
Networking
VERIFIED FIXED
16 years ago
16 years ago

People

(Reporter: stephend@netscape.com (gone - use stephen.donner@gmail.com instead), Assigned: bbaetz)

Tracking

({memory-leak})

Trunk
mozilla1.1beta
x86
Windows 2000
memory-leak
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

1.88 KB, patch
Steve Meredith (gone)
: review+
Alec Flett
: superreview+
Details | Diff | Splinter Review
I hope this isn't bogus, but I see this on Windows 2000 running under Purify, 
just accessing my IMAP account with a SOCKS Proxy V5 server.

If this turns out to be bogus, I'll invalidate it faster than you can 
exclaim 'Shazam'.

    [W] MLK: Memory leak of 18 bytes from 1 block allocated in PL_strdup
    Distribution of leaked blocks
    Allocation location
        malloc         [MSVCRT.DLL]
        PL_strdup      [strdup.c:46]
        nsSOCKSSocketInfo::GetProxyHost(char * *) [nsSOCKSIOLayer.cpp:103]
                if (!aProxyHost) return NS_ERROR_NULL_POINTER;
                if (mProxyHost)
                {
         =>         *aProxyHost = nsCRT::strdup(mProxyHost);
                    return (*aProxyHost == nsnull) ? NS_ERROR_OUT_OF_MEMORY : 
NS_OK;
                }
                else
        ???            [ip=0x0922b288]
        nsSOCKSIOLayerConnect [nsSOCKSIOLayer.cpp:568]
                PRHostEnt hostentry;
                char * proxyHost;
            
         =>     nsresult rv = info->GetProxyHost(&proxyHost);
            
                if (NS_FAILED(rv) || !proxyHost || !(*proxyHost)) {
                    return PR_FAILURE;
        PR_Connect     [priometh.c:181]
        nsSocketTransport::doConnection(short) [nsSocketTransport.cpp:955]
                    //    This is only done the first time doConnection(...) is 
called.
                    //
                    if (NS_SUCCEEDED(rv)) {
         =>             status = PR_Connect(mSocketFD, mNetAddress, 
gConnectTimeout);
                        if (PR_SUCCESS != status) {
                            PRErrorCode code = PR_GetError();
                            //
        nsSocketTransport::Process(short) [nsSocketTransport.cpp:538]
        nsSocketTransportService::ProcessWorkQ(void) 
[nsSocketTransportService.cpp:317]
        nsSocketTransportService::Run(void) [nsSocketTransportService.cpp:563]
        nsThread::Main(void *) [nsThread.cpp:120]
        PR_NativeRunThread [pruthr.c:433]
        TlsSetValue    [KERNEL32.dll]
Keywords: mlk
QA Contact: benc → stephend
(Assignee)

Comment 1

16 years ago
This looks real.

If you change like 566-570 in nsSOCKSIOLayer.cpp (the proxyHost delcaration) to:

nsXPIDLCString proxyHost;
nsresult rv = info->GetProxyHost(getter_Copies(proxyHost));
if (NS_FAILED(rv) || proxyHost.IsEmpty()) {

then add .get() to fix the compile errors, does that fix the leak?
Add get() where?

Can you just provide a patch that I can test, please?  Thanks.
(Assignee)

Comment 3

16 years ago
Created attachment 89706 [details] [diff] [review]
patch

This compiles, but I haven't tested it runs.
This both works and seems to fix the leak on Windows 2000.

SOCKS operations remain normal with this patch.

Comment 5

16 years ago
Comment on attachment 89706 [details] [diff] [review]
patch

r=smeredith
Attachment #89706 - Flags: review+
(Assignee)

Updated

16 years ago
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.1beta

Comment 6

16 years ago
Comment on attachment 89706 [details] [diff] [review]
patch

sr=alecf
Attachment #89706 - Flags: superreview+
(Assignee)

Comment 8

16 years ago
Checked into trunk.
Status: ASSIGNED → RESOLVED
Last Resolved: 16 years ago
Resolution: --- → FIXED
Verified FIXED, thanks for taking care of this so rapidly.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.