Fix http-fetch
With the latest changes in fetch.c, http-fetch crashed accessing write_ref[i], where write_ref was NULL. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Johannes Schindelin committed
Jul 29, 2006 at 02:10 UTC
1b03dfed182a1dc47cc0eb1047a34cd914440ce6
1 file changed
+3
-3
fetch.c
+3
-3
@@ -245,7 +245,7 @@ void pull_targets_free(int targets, char **target, const char **write_ref)
245
{
246
while (targets--) {
247
free(target[targets]);
248
- if (write_ref[targets])
248
+ if (write_ref && write_ref[targets])
249
free((char *) write_ref[targets]);
250
}
251
}
@@ -263,7 +263,7 @@ int pull(int targets, char **target, const char **write_ref,
263
track_object_refs = 0;
264
265
for (i = 0; i < targets; i++) {
266
- if (!write_ref[i])
266
+ if (!write_ref || !write_ref[i])
267
continue;
268
269
lock[i] = lock_ref_sha1(write_ref[i], NULL, 0);
@@ -295,7 +295,7 @@ int pull(int targets, char **target, const char **write_ref,
295
msg = NULL;
296
}
297
for (i = 0; i < targets; i++) {
298
- if (!write_ref[i])
298
+ if (!write_ref || !write_ref[i])
299
continue;
300
ret = write_ref_sha1(lock[i], &sha1[20 * i], msg ? msg : "fetch (unknown)");
301
lock[i] = NULL;