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

Re: [PATCH] http*: cleanup slot->local after fclose

From
Junio C Hamano <gitster@pobox.com>
Date
May 31, 2009, 06:17 UTC
Message-ID
<7vy6sdssnk.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20090531000955.953725d9.rctay89@gmail.com>
Tay Ray Chuan <rctay89@gmail.com> writes:
Show 19 quoted lines
> Set slot->local to NULL after doing a fclose on the FILE* pointer it
> points to.
>
> Move NULL assignment to request->slot from
> http-push.c::finish_request() to http-push.c::release_request(). This
> is safe, since the functions finish_request() invoke will overwrite
> request->slot anyway.
>
> Refactor http-push.c::fetch_index(), http-walker.c::fetch_index() and
> http-walker.c::fetch_pack() to use labels while cleaning up.
>
> This fixes the issue raised by Clemens Buchacher on 30th May:
>
>   http://www.spinics.net/lists/git/msg104623.html
>
> Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
> ---
>
>  This applies on master, and is a resend, this time with the subject.
Shouldn't a fix instead be queued for 'maint', without "refactoring"?
Is there a reproducible repipe you can add to the test script?
Show 16 quoted lines
>  http-push.c   |   23 ++++++++++++++---------
>  http-walker.c |   36 +++++++++++++++++++++++-------------
>  2 files changed, 37 insertions(+), 22 deletions(-)
>
> diff --git a/http-push.c b/http-push.c
> index dac2c6e..816824a 100644
> --- a/http-push.c
> +++ b/http-push.c
> @@ -715,6 +715,8 @@ static void release_request(struct transfer_request *request)
>  		close(request->local_fileno);
>  	if (request->local_stream)
>  		fclose(request->local_stream);
> +	if (request->slot)
> +		request->slot = NULL;
>  	free(request->url);
>  	free(request);

Hmm, what's the point of setting NULL to request->slot if you are already freeing "request" that contains the field?

Previous: Clemens BuchacherNext: Tay Ray Chuan
Message 9 of 15 in “http-push: send out fetch requests on queue”
  1. 3/3 http-push: send out fetch requests on queueTay Ray Chuan, Apr 24, 2009
  2. Clemens BuchacherMay 30, 2009
  3. Tay Ray ChuanMay 30, 2009
  4. Clemens BuchacherMay 30, 2009
  5. Tay Ray ChuanMay 30, 2009
  6. Tay Ray ChuanMay 30, 2009
  7. http*: cleanup slot->local after fcloseTay Ray Chuan, May 30, 2009
  8. Clemens BuchacherMay 30, 2009
  9. Junio C HamanoMay 31, 2009
  10. Tay Ray ChuanMay 31, 2009
  11. http*: cleanup slot->local after fcloseTay Ray Chuan, May 31, 2009
  12. Junio C HamanoMay 31, 2009
  13. Tay Ray ChuanJun 1, 2009
  14. Junio C HamanoJun 1, 2009
  15. Tay Ray ChuanJun 2, 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.