git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Check return value of ftruncate call in http.c. Remove possible mem leak

From
Tay Ray Chuan <rctay89@gmail.com>
Date
Aug 10, 2009, 15:47 UTC
Message-ID
<be6fef0d0908100847h7e9b53a2ofdf318e9958be3b2@mail.gmail.com>
In-Reply-To
<1249911747-28490-1-git-send-email-jeff.lasslett@gmail.com>
Hi,
On Mon, Aug 10, 2009 at 9:42 PM, Jeff Lasslett<jeff.lasslett@gmail.com> wrote:
Show 8 quoted lines
> @@ -1216,10 +1220,12 @@ struct http_object_request *new_http_object_request(const char *base_url,
>                                 CURLOPT_HTTPHEADER, range_header);
>        }
>
> +       free(url);
>        return freq;
>
> -       free(url);
Freeing after the return didn't make sense. Thanks for spotting this.

On a side note, you could simply do away with the 'url' variable, since you're going to pass freq->url to curl_setopt.

-- 
Cheers,
Ray Chuan
Previous: Jeff LasslettNext: Tay Ray Chuan
Message 2 of 6 in “Check return value of ftruncate call in http.c. Remove possible mem leak”
  1. Check return value of ftruncate call in http.c. Remove possible mem leakJeff Lasslett, Aug 10, 2009
  2. Tay Ray ChuanAug 10, 2009
  3. 1/3 http.c: free preq when abortingTay Ray Chuan, Aug 10, 2009
  4. 2/3 http.c: replace usage of temporary variable for urlsTay Ray Chuan, Aug 10, 2009
  5. 3/3 Check return value of ftruncate call in http.cTay Ray Chuan, Aug 10, 2009
  6. Junio C HamanoAug 11, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.