From add8e8cee5054734cb19d918f83bcee649aab326 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 14 Feb 2008 23:25:33 +0000 Subject: http-push: avoid invalid memory accesses Before objects are sent, the respective ref is locked. However, without this patch, the lock is lifted before the last object for that ref was sent. As a consequence, the lock data was accessed after the lock structure was free()d. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano diff --git a/http-push.c b/http-push.c index b2b410d..386b806 100644 --- a/http-push.c +++ b/http-push.c @@ -2398,7 +2398,12 @@ int main(int argc, char **argv) fill_active_slots(); add_fill_function(NULL, fill_active_slot); #endif - finish_all_active_slots(); + do { + finish_all_active_slots(); +#ifdef USE_CURL_MULTI + fill_active_slots(); +#endif + } while (request_queue_head && !aborted); /* Update the remote branch if all went well */ if (aborted || !update_remote(ref->new_sha1, ref_lock)) { -- cgit v0.10.2-6-g49f6 From 1bbeb4c6905b18446485413d98f4b75e56a6830c Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 14 Feb 2008 23:32:32 +0000 Subject: http-push: do not get confused by submodules When encountering submodules in a tree, http-push should not try sending the respective object. Instead, it should ignore it. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano diff --git a/http-push.c b/http-push.c index 386b806..14ef652 100644 --- a/http-push.c +++ b/http-push.c @@ -1634,12 +1634,19 @@ static struct object_list **process_tree(struct tree *tree, init_tree_desc(&desc, tree->buffer, tree->size); - while (tree_entry(&desc, &entry)) { - if (S_ISDIR(entry.mode)) + while (tree_entry(&desc, &entry)) + switch (object_type(entry.mode)) { + case OBJ_TREE: p = process_tree(lookup_tree(entry.sha1), p, &me, name); - else + break; + case OBJ_BLOB: p = process_blob(lookup_blob(entry.sha1), p, &me, name); - } + break; + default: + /* Subproject commit - not in this repository */ + break; + } + free(tree->buffer); tree->buffer = NULL; return p; -- cgit v0.10.2-6-g49f6 From 7fea9c551436a98edf4ab6840de981f99b7db687 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 14 Feb 2008 23:26:12 +0000 Subject: http-push: avoid a needless goto There was a goto, and while it is not half as harmful as some people believe, it was unnecessary here. So remove it for readability. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano diff --git a/http-push.c b/http-push.c index 14ef652..f9b77d6 100644 --- a/http-push.c +++ b/http-push.c @@ -2413,12 +2413,9 @@ int main(int argc, char **argv) } while (request_queue_head && !aborted); /* Update the remote branch if all went well */ - if (aborted || !update_remote(ref->new_sha1, ref_lock)) { + if (aborted || !update_remote(ref->new_sha1, ref_lock)) rc = 1; - goto unlock; - } - unlock: if (!rc) fprintf(stderr, " done\n"); unlock_remote(ref_lock); -- cgit v0.10.2-6-g49f6