)]}'
{
  "commit": "68ffe095a25b4aba1d6aa1386318ddc8dadcf8c2",
  "tree": "ac1ed83ff3c9df7fdfa5981134e551709b67381f",
  "parents": [
    "64cc539fd2f8e02f39cfae21e9523da2532c0467"
  ],
  "author": {
    "name": "Andrzej Hunt",
    "email": "ajrhunt@google.com",
    "time": "Sun Mar 21 16:58:37 2021 +0000"
  },
  "committer": {
    "name": "Junio C Hamano",
    "email": "gitster@pobox.com",
    "time": "Sun Mar 21 14:39:10 2021 -0700"
  },
  "message": "transport: also free remote_refs in transport_disconnect()\n\ntransport_get_remote_refs() can populate the transport struct\u0027s\nremote_refs. transport_disconnect() is already responsible for most of\ntransport\u0027s cleanup - therefore we also take care of freeing remote_refs\nthere.\n\nThere are 2 locations where transport_disconnect() is called before\nwe\u0027re done using the returned remote_refs. This patch changes those\ncallsites to only call transport_disconnect() after the returned refs\nare no longer being used - which is necessary to safely be able to\nfree remote_refs during transport_disconnect().\n\nThis commit fixes the following leak which was found while running\nt0000, but is expected to also fix the same pattern of leak in all\nlocations that use transport_get_remote_refs():\n\nDirect leak of 165 byte(s) in 1 object(s) allocated from:\n    #0 0x49a6b2 in calloc /home/abuild/rpmbuild/BUILD/llvm-11.0.0.src/build/../projects/compiler-rt/lib/asan/asan_malloc_linux.cpp:154:3\n    #1 0x9a72f2 in xcalloc /home/ahunt/oss-fuzz/git/wrapper.c:140:8\n    #2 0x8ce203 in alloc_ref_with_prefix /home/ahunt/oss-fuzz/git/remote.c:867:20\n    #3 0x8ce1a2 in alloc_ref /home/ahunt/oss-fuzz/git/remote.c:875:9\n    #4 0x72f63e in process_ref_v2 /home/ahunt/oss-fuzz/git/connect.c:426:8\n    #5 0x72f21a in get_remote_refs /home/ahunt/oss-fuzz/git/connect.c:525:8\n    #6 0x979ab7 in handshake /home/ahunt/oss-fuzz/git/transport.c:305:4\n    #7 0x97872d in get_refs_via_connect /home/ahunt/oss-fuzz/git/transport.c:339:9\n    #8 0x9774b5 in transport_get_remote_refs /home/ahunt/oss-fuzz/git/transport.c:1388:4\n    #9 0x51cf80 in cmd_clone /home/ahunt/oss-fuzz/git/builtin/clone.c:1271:9\n    #10 0x4cd60d in run_builtin /home/ahunt/oss-fuzz/git/git.c:453:11\n    #11 0x4cb2da in handle_builtin /home/ahunt/oss-fuzz/git/git.c:704:3\n    #12 0x4ccc37 in run_argv /home/ahunt/oss-fuzz/git/git.c:771:4\n    #13 0x4cac29 in cmd_main /home/ahunt/oss-fuzz/git/git.c:902:19\n    #14 0x69c45e in main /home/ahunt/oss-fuzz/git/common-main.c:52:11\n    #15 0x7f6a459d5349 in __libc_start_main (/lib64/libc.so.6+0x24349)\n\nSigned-off-by: Andrzej Hunt \u003cajrhunt@google.com\u003e\nSigned-off-by: Junio C Hamano \u003cgitster@pobox.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "ef604752a044a48609a10ee90a8ca487c0acfb2d",
      "old_mode": 33188,
      "old_path": "builtin/ls-remote.c",
      "new_id": "5432d239a681e212a0b60027172ff89f4be17f1e",
      "new_mode": 33188,
      "new_path": "builtin/ls-remote.c"
    },
    {
      "type": "modify",
      "old_id": "d11a5589e49dcc9ea06663c422154855f9ad529b",
      "old_mode": 33188,
      "old_path": "builtin/remote.c",
      "new_id": "e31d9c99470e8e38c7b0ffe0611f1f51ace1c1af",
      "new_mode": 33188,
      "new_path": "builtin/remote.c"
    },
    {
      "type": "modify",
      "old_id": "b13fab5dc3b1b90933b77f15fe87ca422cc70784",
      "old_mode": 33188,
      "old_path": "transport.c",
      "new_id": "62362d79dd876a47a223ab5903d5c26d99ad09ea",
      "new_mode": 33188,
      "new_path": "transport.c"
    }
  ]
}
