)]}'
{
  "commit": "48176f953fe083e2f15dd4daa2e37c28950135f1",
  "tree": "8b2b9aa82a795c84a098c0546acd9172c7f513f8",
  "parents": [
    "9a2fb147f2c61d0cab52c883e7e26f5b7948e3ed"
  ],
  "author": {
    "name": "Junio C Hamano",
    "email": "gitster@pobox.com",
    "time": "Sun Dec 07 13:40:46 2025 +0900"
  },
  "committer": {
    "name": "Junio C Hamano",
    "email": "gitster@pobox.com",
    "time": "Tue Dec 09 07:11:42 2025 +0900"
  },
  "message": "connect: plug protocol capability leak\n\nWhen pushing to a set of remotes using a nickname for the group, the\nclient initializes the connection to each remote, talks to the\nremote and reads and parses capabilities line, and holds the\ncapabilities in a file-scope static variable server_capabilities_v1.\n\nThere are a few other such file-scope static variables, and these\nconnections cannot be parallelized until they are refactored to a\nstructure that keeps track of active connections.\n\nWhich is *not* the theme of this patch ;-)\n\nFor a single connection, the server_capabilities_v1 variable is\ninitialized to NULL (at the program initialization), populated when\nwe talk to the other side, used to look up capabilities of the other\nside possibly multiple times, and the memory is held by the variable\nuntil program exit, without leaking.  When talking to multiple remotes,\nhowever, the server capabilities from the second connection overwrites\nwithout freeing the one from the first connection, which leaks.\n\n    \u003d\u003d1080970\u003d\u003dERROR: LeakSanitizer: detected memory leaks\n\n    Direct leak of 421 byte(s) in 2 object(s) allocated from:\n\t#0 0x5615305f849e in strdup (/home/gitster/g/git-jch/bin/bin/git+0x2b349e) (BuildId: 54d149994c9e85374831958f694bd0aa3b8b1e26)\n\t#1 0x561530e76cc4 in xstrdup /home/gitster/w/build/wrapper.c:43:14\n\t#2 0x5615309cd7fa in process_capabilities /home/gitster/w/build/connect.c:243:27\n\t#3 0x5615309cd502 in get_remote_heads /home/gitster/w/build/connect.c:366:4\n\t#4 0x561530e2cb0b in handshake /home/gitster/w/build/transport.c:372:3\n\t#5 0x561530e29ed7 in get_refs_via_connect /home/gitster/w/build/transport.c:398:9\n\t#6 0x561530e26464 in transport_push /home/gitster/w/build/transport.c:1421:16\n\t#7 0x561530800bec in push_with_options /home/gitster/w/build/builtin/push.c:387:8\n\t#8 0x5615307ffb99 in do_push /home/gitster/w/build/builtin/push.c:442:7\n\t#9 0x5615307fe926 in cmd_push /home/gitster/w/build/builtin/push.c:664:7\n\t#10 0x56153065673f in run_builtin /home/gitster/w/build/git.c:506:11\n\t#11 0x56153065342f in handle_builtin /home/gitster/w/build/git.c:779:9\n\t#12 0x561530655b89 in run_argv /home/gitster/w/build/git.c:862:4\n\t#13 0x561530652cba in cmd_main /home/gitster/w/build/git.c:984:19\n\t#14 0x5615308dda0a in main /home/gitster/w/build/common-main.c:9:11\n\t#15 0x7f051651bca7 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16\n\n    SUMMARY: AddressSanitizer: 421 byte(s) leaked in 2 allocation(s).\n\nFree the capablities data for the previous server before overwriting\nit with the next server to plug this leak.\n\nThe added test fails without the freeing with SANITIZE\u003dleak; I\nsomehow couldn\u0027t get it fail reliably with SANITIZE\u003dleak,address\nthough.\n\nSigned-off-by: Junio C Hamano \u003cgitster@pobox.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "8352b71faf0931a65f174c8b60149315b979625b",
      "old_mode": 33188,
      "old_path": "connect.c",
      "new_id": "c6f76e30829ff2619bec631100aa025b865e2aa7",
      "new_mode": 33188,
      "new_path": "connect.c"
    },
    {
      "type": "modify",
      "old_id": "a5531df415ffe2cda8ff81fd688e9cb1e6717ab4",
      "old_mode": 33188,
      "old_path": "t/meson.build",
      "new_id": "a7c477f1fb0b91b17937fc7ddb538b03cf1af6c5",
      "new_mode": 33188,
      "new_path": "t/meson.build"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "7e93668566987b5fb193e2a8cb7f7a6a15f8939c",
      "new_mode": 33261,
      "new_path": "t/t5565-push-multiple.sh"
    }
  ]
}
