cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker mailing list Archives

[ curl-Bugs-1780194 ] memory leak if proxy empty string

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Thu, 23 Aug 2007 10:35:53 -0700

Bugs item #1780194, was opened at 2007-08-23 06:04
Message generated for change (Comment added) made by dfandrich
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1780194&group_id=976

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: libcurl
Group: wrong behaviour
Status: Open
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Ivosh (iraisr)
Assigned to: Daniel Stenberg (bagder)
Summary: memory leak if proxy empty string

Initial Comment:
In libcurl version 7.16.2, there is a memory leak in CreateConnection function (url.c module) if data->set.proxy is an empty string.

On line 2969, proxy gets its content via strdup().
On line 3365 the test fails because (proxy != NULL) && (*proxy == '\0').
But proxy is not freed anywhere below.
I fixed the leak by adding the following at line 3478:
  else if (proxy != NULL) {
      free(proxy);
      proxy = NULL;
  }

But I think better logic will be not to call strdup for proxy at all. In this case also logic on line 2982 needs to be altered (because data->set.proxy specified an empty proxy).

----------------------------------------------------------------------

>Comment By: Dan Fandrich (dfandrich)
Date: 2007-08-23 10:35

Message:
Logged In: YES
user_id=236775
Originator: NO

I believe I fixed this as part of the CreateConnection refactoring I did
last month. I've added test case 1004 to test this situation (it fails on
7.16.4 and passes on CVS).

----------------------------------------------------------------------

Comment By: Daniel Stenberg (bagder)
Date: 2007-08-23 07:26

Message:
Logged In: YES
user_id=1110
Originator: NO

1 - I can't repeat any leak with current CVS when I try to do 'curl -x ""
localhost'. Is that what leaks for you? Also, the line numbers and code
you're referring to no longer exist like that...

2 - a given blank proxy is signifiant as it means explicitly disable a
proxy so we need to differentiate between no proxy set and one set to "",
so a strdup() for all non-NULL cases makes it a lot easier code-wise.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1780194&group_id=976
Received on 2007-08-23

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET