[PATCH] http-push: fix webdav lock leak.
- From
- Grégoire Barbier <gb@gbarbier.org>
- Date
- Jan 13, 2008, 19:02 UTC
- Message-ID
- <1200250979-19604-2-git-send-email-gb@gbarbier.org>
- In-Reply-To
- <1200250979-19604-1-git-send-email-gb@gbarbier.org>
Releasing webdav lock even if push fails because of bad (or no) reference on command line.
Signed-off-by: Grégoire Barbier <gb@gbarbier.org> --- http-push.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/http-push.c b/http-push.c index c005903..cbbf432 100644 --- a/http-push.c +++ b/http-push.c @@ -2275,11 +2275,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; @@ -2410,10 +2413,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); curl_slist_free_all(no_pragma_header);
-- 1.5.3.6