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

Re: [PATCH] http-push: fix webdav lock leak.

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jan 19, 2008, 23:08 UTC
Message-ID
<alpine.LSU.1.00.0801192302340.5731@racer.site>
In-Reply-To
<1200756171-11696-1-git-send-email-gb@gbarbier.org>
Hi,
On Sat, 19 Jan 2008, Grégoire Barbier wrote:
Show 33 quoted lines
> diff --git a/http-push.c b/http-push.c
> index eef7674..2c4e91d 100644
> --- a/http-push.c
> +++ b/http-push.c
> @@ -2264,11 +2264,14 @@ int main(int argc, char **argv)
>  	if (!remote_tail)
>  		remote_tail = &remote_refs;
>  	if (match_refs(local_refs, remote_refs, &remote_tail,
> -		       nr_refspec, (const char **) refspec, push_all))
> -		return -1;
> +		       nr_refspec, (const char **) refspec, push_all)) {
> +		rc = -1;
> +		goto cleanup;
> +	}
>  	if (!remote_refs) {
>  		fprintf(stderr, "No refs in common and none specified; doing nothing.\n");
> -		return 0;
> +		rc = 0;
> +		goto cleanup;
>  	}
>  
>  	new_refs = 0;
> @@ -2399,10 +2402,10 @@ int main(int argc, char **argv)
>  			fprintf(stderr, "Unable to update server info\n");
>  		}
>  	}
> -	if (info_ref_lock)
> -		unlock_remote(info_ref_lock);
>  
>   cleanup:
> +	if (info_ref_lock)
> +		unlock_remote(info_ref_lock);
>  	free(remote);

This late in the rc cycle, together with my unfamiliarity of the code and the code paths in http.c and http-push.c would make me feel _much_ better if you could insert the "if (info_ref_lock)" before the returns, instead of replacing the returns with "goto cleanup"s...

Thanks, Dscho

Previous: Junio C Hamano
Message 13 of 13 in “http-push: fix webdav lock leak.”
  1. http-push: fix webdav lock leak.Grégoire Barbier, Jan 19, 2008
  2. http-push: fail when info/refs exists and is already lockedGrégoire Barbier, Jan 19, 2008
  3. http-push: more explicit error message with bad URL or passwordGrégoire Barbier, Jan 19, 2008
  4. http-push and http-fetch: handle URLs without leading /Grégoire Barbier, Jan 19, 2008
  5. added #define DEFAULT_MAX_REQUESTS for USE_CURL_MULTI modeGrégoire Barbier, Jan 19, 2008
  6. Junio C HamanoJan 21, 2008
  7. Grégoire BarbierJan 21, 2008
  8. Junio C HamanoJan 21, 2008
  9. Mike HommeyJan 19, 2008
  10. Johannes SchindelinJan 19, 2008
  11. Johannes SchindelinJan 19, 2008
  12. Junio C HamanoJan 20, 2008
  13. Johannes SchindelinJan 19, 2008

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.