{"thread":{"id":"5033","subject":"[PATCH] Fix http-fetch","startedAt":"2006-07-29T00:10:07Z","lastAt":"2006-07-29T00:10:07Z","messageCount":1,"participants":["Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"24320","messageId":"Pine.LNX.4.63.0607290208580.29667@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"5033","inReplyTo":null,"subject":"[PATCH] Fix http-fetch","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-07-29T00:10:07Z","receivedAt":"2006-07-29T00:10:07Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nWith the latest changes in fetch.c, http-fetch crashed accessing \nwrite_ref[i], where write_ref was NULL.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n fetch.c |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/fetch.c b/fetch.c\nindex 2151c7b..aeb6bf2 100644\n--- a/fetch.c\n+++ b/fetch.c\n@@ -245,7 +245,7 @@ void pull_targets_free(int targets, char\n {\n \twhile (targets--) {\n \t\tfree(target[targets]);\n-\t\tif (write_ref[targets])\n+\t\tif (write_ref && write_ref[targets])\n \t\t\tfree((char *) write_ref[targets]);\n \t}\n }\n@@ -263,7 +263,7 @@ int pull(int targets, char **target, con\n \ttrack_object_refs = 0;\n \n \tfor (i = 0; i < targets; i++) {\n-\t\tif (!write_ref[i])\n+\t\tif (!write_ref || !write_ref[i])\n \t\t\tcontinue;\n \n \t\tlock[i] = lock_ref_sha1(write_ref[i], NULL, 0);\n@@ -295,7 +295,7 @@ int pull(int targets, char **target, con\n \t\tmsg = NULL;\n \t}\n \tfor (i = 0; i < targets; i++) {\n-\t\tif (!write_ref[i])\n+\t\tif (!write_ref || !write_ref[i])\n \t\t\tcontinue;\n \t\tret = write_ref_sha1(lock[i], &sha1[20 * i], msg ? msg : \"fetch (unknown)\");\n \t\tlock[i] = NULL;\n-- \n1.4.2.rc2.g0d86-dirty\n"}]}