Git fork

Merge branch 'tc/bundle-uri-leakfix'

Leakfix.

* tc/bundle-uri-leakfix:
bundle-uri: plug leak in unbundle_from_file()

+13 -5
+13 -5
bundle-uri.c
··· 368 368 struct strbuf bundle_ref = STRBUF_INIT; 369 369 size_t bundle_prefix_len; 370 370 371 - if ((bundle_fd = read_bundle_header(file, &header)) < 0) 372 - return 1; 371 + bundle_fd = read_bundle_header(file, &header); 372 + if (bundle_fd < 0) { 373 + result = 1; 374 + goto cleanup; 375 + } 373 376 374 377 /* 375 378 * Skip the reachability walk here, since we will be adding 376 379 * a reachable ref pointing to the new tips, which will reach 377 380 * the prerequisite commits. 378 381 */ 379 - if ((result = unbundle(r, &header, bundle_fd, NULL, 380 - VERIFY_BUNDLE_QUIET | (fetch_pack_fsck_objects() ? VERIFY_BUNDLE_FSCK : 0)))) 381 - return 1; 382 + result = unbundle(r, &header, bundle_fd, NULL, 383 + VERIFY_BUNDLE_QUIET | (fetch_pack_fsck_objects() ? VERIFY_BUNDLE_FSCK : 0)); 384 + if (result) { 385 + result = 1; 386 + goto cleanup; 387 + } 382 388 383 389 /* 384 390 * Convert all refs/heads/ from the bundle into refs/bundles/ ··· 407 413 0, UPDATE_REFS_MSG_ON_ERR); 408 414 } 409 415 416 + cleanup: 417 + strbuf_release(&bundle_ref); 410 418 bundle_header_release(&header); 411 419 return result; 412 420 }