cURL / Mailing Lists / curl-users / Single Mail

curl-users

RE: Deferred Synchronous using Multi Interface

From: <Priya.Ramakrishnan_at_WellsFargo.COM>
Date: Thu, 27 Jun 2002 17:15:45 -0700

Hi

I am getting a memory leak when i am using curl_escape to URL encode the
message.
Here is the code snippet. For this particular test i used Libcurl 7.9.6

    if ((msgType == HTMLFORMENCODED_SOAPWRAPPED) || ( msgType ==
HTMLFORMENCODED_NOTSOAPWRAPPED))
    {
      if (pMessageTag != 0)
      {
        requestString.assign(pMessageTag->c_str());
        requestString.append("=");
      }
      else
      {
        requestString = "message=";
      }

      encString.assign(curl_escape(bufferPointer.c_str(),bufferLength));
      requestString.append(encString);
      curl_easy_setopt(m_pCurl, CURLOPT_POSTFIELDS, requestString.c_str());
      curl_easy_setopt(m_pCurl, CURLOPT_POSTFIELDSIZE,
requestString.length());
    }
    else
    {
      curl_easy_setopt(m_pCurl, CURLOPT_POSTFIELDS, bufferPointer.c_str());
      curl_easy_setopt(m_pCurl, CURLOPT_POSTFIELDSIZE, bufferLength);
    }

And here is the result of my test in Purify

MLK: 4368 bytes leaked in 2 blocks
  * This memory was allocated from:
  malloc [rtlib.o]
  realloc [rtlib.o]
  curl_escape [escape.c:60]
  _ZN3BCA12CCurlWrapper4postERKSsS2_lNS_12EMessageTypeEPS1_
[basic_string.h:714]
  _ZN3BCA11CHttpClient4sendERKSsRKNS_3XMLENS_12EMessageTypeEPS1_
[basic_string.h:400]
  _ZN3BCA11HttpWrapper4sendERKSsRKNS_3XMLENS_12EMessageTypeEPS1_
[HttpWrapper.cpp:28]
  * Block of 2578 bytes at 0x3b7a08
  * Block of 1790 bytes at 0x3b8470

Can you tell me what is the problem.

Thank You
Priya Ramakrishnan

Ph:415 396 8985

-----Original Message-----
From: Daniel Stenberg
Sent: Tuesday, June 25, 2002 11:43 PM
To: Priya.Ramakrishnan_at_WellsFargo.COM
Cc: Curl Mailinglist
Subject: RE: Deferred Synchronous using Multi Interface

On Tue, 25 Jun 2002 Priya.Ramakrishnan_at_WellsFargo.COM wrote:

> I think i can do it this way. I will work on this and give back a result
> fast.

Also consider using the libcurl mailing list instead, as most of the libcurl
using dudes are over there and you might get better answers on that list...
:-)

> Also was the libcurl.def modified in 7.9.8 in CurlLib.dsw. In 7.9.7 it did
> not have the multi interfaces and so there were linker problems

Eh, it was supposed to be fixed in 7.9.8 but due to some line ending
problems
MSVC dislikes the file and a new one was committed to CVS *after* the 7.9.8
release. Get your copy of this corrected version from here:

  http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/curl/curl/lib/

-- 
    Daniel Stenberg -- starting tomorrow, I'm gone for a month
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Bringing you mounds of caffeinated joy.
http://thinkgeek.com/sf
Received on 2002-06-28