cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker Archives

[curl:bugs] #1177 memory leak when Curl_follow() fails

From: Nach M. S. <n-a-c-h_at_users.sf.net>
Date: Thu, 30 May 2013 12:34:54 +0000

Here's your fix. It simply moves the NULL assignment within the success check, from outside of it, to ensure it properly tells the if below when to free.

I moved the use right above it which did not leak memory into a nested if, as the second if would never occur if the first didn't, and would probably optimize into my change anyway, but this way it's clearer that there is no memory leak above either.

Attachment: multi-fix.c (97.5 kB; text/x-csrc)

---
** [bugs:#1177] memory leak when Curl_follow() fails**
**Status:** open-confirmed
**Labels:** memory leak 
**Created:** Fri Dec 21, 2012 01:26 PM UTC by Daniel Stenberg
**Last Updated:** Thu May 30, 2013 12:25 PM UTC
**Owner:** Daniel Stenberg
On github, seanbcos correctly pointed out that Curl_follow() only "takes ownership" of the passed in newurl pointer if it succeeds. If it returns error, it is still left to the caller to free the memory and after a recent commit that isn't always done. We better fix...
https://github.com/bagder/curl/commit/18fdd46a4b7bda95e5100248015582d63c0031aa#commitcomment-2259930
---
Sent from sourceforge.net because you indicated interest in <https://sourceforge.net/p/curl/bugs/1177/>
To unsubscribe from further messages, please visit <https://sourceforge.net/auth/subscriptions/>
Received on 2013-05-30

These mail archives are generated by hypermail.

donate! Page updated May 06, 2013.
web site info

File upload with ASP.NET