)]}'
{
  "commit": "dafd73bcda60e9a54bdd43c79337dce452b1d8af",
  "tree": "4053039ae848a1997a543474a5dc3d78babce65e",
  "parents": [
    "fc7126f8630423ce0224f83e2688fd14fc01d2b7"
  ],
  "author": {
    "name": "Matthieu Longo",
    "email": "matthieu.longo@arm.com",
    "time": "Tue May 26 11:46:29 2026 +0100"
  },
  "committer": {
    "name": "Matthieu Longo",
    "email": "matthieu.longo@arm.com",
    "time": "Thu Jun 04 15:09:54 2026 +0100"
  },
  "message": "gdb/python: fix memory leak in gdb_py_tp_name\n\nThe current implementation of gdb_py_tp_name() leaks a reference to the\nobject returned by PyType_GetFullyQualifiedName() for Python \u003e\u003d 3.13, and\nPyType_GetQualName() for Python \u003e\u003d 3.11.\n\nManaging the strong reference on the returned PyObject* with a gdbpy_ref\u003c\u003e\nfixes the reference count, but also causes the temporary object to be\ndeallocated on function exit. As a consequence, the \u0027const char *\u0027 returned\nby PyUnicode_AsUTF8AndSize() becomes dangling and can no longer safely be\nreturned.\n\nThe proposed approach consists in changing gdb_py_tp_name() to return a\nstd::string, and forcing a copy of the \u0027const char *\u0027 value, statically\nor dynamically allocated, stored in a temporary or non-temporary PyObject,\ndepending on the version of Python it was compiled with.\nAn unfortunate side effect of this fix is that every call sites where the\ntp_name is printed, must now use `.c_str()\u0027 because PyErr_Format()\nand its siblings cannot handle std::string.\n\nApproved-By: Andrew Burgess \u003caburgess@redhat.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "7a0cb0a2a59802b48e09e93d80af182c81088c21",
      "old_mode": 33188,
      "old_path": "gdb/python/py-arch.c",
      "new_id": "5b3cfbdc876ddaf1db6039e25d4f7311cd637648",
      "new_mode": 33188,
      "new_path": "gdb/python/py-arch.c"
    },
    {
      "type": "modify",
      "old_id": "903f800683a06944352470cdec4f9c70ecaa659c",
      "old_mode": 33188,
      "old_path": "gdb/python/py-block.c",
      "new_id": "99c487bc875914bba8859f5356dd6256345ad4bd",
      "new_mode": 33188,
      "new_path": "gdb/python/py-block.c"
    },
    {
      "type": "modify",
      "old_id": "d1fec6a770062537d75908a8997455a612cbdab0",
      "old_mode": 33188,
      "old_path": "gdb/python/py-breakpoint.c",
      "new_id": "30d5ea471c2a433213f2b2d86579fb7872449b11",
      "new_mode": 33188,
      "new_path": "gdb/python/py-breakpoint.c"
    },
    {
      "type": "modify",
      "old_id": "02330b2806818f90ed109eb5ffa5c3738a1fd9a9",
      "old_mode": 33188,
      "old_path": "gdb/python/py-connection.c",
      "new_id": "bc738669b79459f82a4b09df87bbb63ad5447be2",
      "new_mode": 33188,
      "new_path": "gdb/python/py-connection.c"
    },
    {
      "type": "modify",
      "old_id": "fbefbd267f48030657d804c079c06f8fb6f9940b",
      "old_mode": 33188,
      "old_path": "gdb/python/py-corefile.c",
      "new_id": "fc5b4889fdcb83c4d9b7ec7a282ff7746af9598a",
      "new_mode": 33188,
      "new_path": "gdb/python/py-corefile.c"
    },
    {
      "type": "modify",
      "old_id": "e5d7174b7d6bf8c0111945faa9596ac187048e62",
      "old_mode": 33188,
      "old_path": "gdb/python/py-disasm.c",
      "new_id": "a2abf37a6052c094c1034ff0e5e1af362406b0f6",
      "new_mode": 33188,
      "new_path": "gdb/python/py-disasm.c"
    },
    {
      "type": "modify",
      "old_id": "0a1a0dffbf9059ad69e7e4aaf3d0442ae26ce561",
      "old_mode": 33188,
      "old_path": "gdb/python/py-frame.c",
      "new_id": "859b8bdbb6e8dacacdff8c647ce7f8d0295f6a28",
      "new_mode": 33188,
      "new_path": "gdb/python/py-frame.c"
    },
    {
      "type": "modify",
      "old_id": "ddb67a284aceda0b4c3e925a30ff1c3260a87ed1",
      "old_mode": 33188,
      "old_path": "gdb/python/py-infthread.c",
      "new_id": "96c736495a8f69833fb5c9bf2588c5fe09e47ad0",
      "new_mode": 33188,
      "new_path": "gdb/python/py-infthread.c"
    },
    {
      "type": "modify",
      "old_id": "1bcb276da8a18039de4b544d520322077c795de0",
      "old_mode": 33188,
      "old_path": "gdb/python/py-mi.c",
      "new_id": "73daefecb20b74fa33e895ed526974f9d90e8a69",
      "new_mode": 33188,
      "new_path": "gdb/python/py-mi.c"
    },
    {
      "type": "modify",
      "old_id": "9ae7fc51bee4488dbdcf829af618aabefb5d4ccd",
      "old_mode": 33188,
      "old_path": "gdb/python/py-micmd.c",
      "new_id": "9f6e664a5f2cdc8fafab49db97bc24cbcc8d60d3",
      "new_mode": 33188,
      "new_path": "gdb/python/py-micmd.c"
    },
    {
      "type": "modify",
      "old_id": "ea0b59a8447e65583cdbe1f35db2c7cacffb35bf",
      "old_mode": 33188,
      "old_path": "gdb/python/py-obj-type.c",
      "new_id": "3ed57d0cbabb69a79cd11005da29bbed7b4391ac",
      "new_mode": 33188,
      "new_path": "gdb/python/py-obj-type.c"
    },
    {
      "type": "modify",
      "old_id": "293647fabfbde847985a081c7919e1325957c984",
      "old_mode": 33188,
      "old_path": "gdb/python/py-obj-type.h",
      "new_id": "ac6c6aa329677f7b50885f51ac1f074329506eca",
      "new_mode": 33188,
      "new_path": "gdb/python/py-obj-type.h"
    },
    {
      "type": "modify",
      "old_id": "c45eba60867e71306e9b8c2be12e009d07bb2534",
      "old_mode": 33188,
      "old_path": "gdb/python/py-style.c",
      "new_id": "a27a1ab75a7c7fdbd646c9a028d0f2396df17280",
      "new_mode": 33188,
      "new_path": "gdb/python/py-style.c"
    },
    {
      "type": "modify",
      "old_id": "5b1d843a36f6f4c95ff9e244d128f00ccdade5f6",
      "old_mode": 33188,
      "old_path": "gdb/python/py-symbol.c",
      "new_id": "5840a3f5720b56c47bb379684b225ffb0b4cfc0b",
      "new_mode": 33188,
      "new_path": "gdb/python/py-symbol.c"
    },
    {
      "type": "modify",
      "old_id": "c002d97d0c6487aa180c7fae82b2e7c3c172a313",
      "old_mode": 33188,
      "old_path": "gdb/python/py-type.c",
      "new_id": "7831e8384818da5038e713832c8ba57f4c1a038e",
      "new_mode": 33188,
      "new_path": "gdb/python/py-type.c"
    },
    {
      "type": "modify",
      "old_id": "7ec87367d0a45c3dfd309a6b2144b606d5eca663",
      "old_mode": 33188,
      "old_path": "gdb/python/py-unwind.c",
      "new_id": "13eced4cecbb86119aa0d2e83a69f2597a048e4a",
      "new_mode": 33188,
      "new_path": "gdb/python/py-unwind.c"
    },
    {
      "type": "modify",
      "old_id": "96f1cb1ee3158de661efaee3fa4e31c511cb8ccb",
      "old_mode": 33188,
      "old_path": "gdb/python/py-utils.c",
      "new_id": "a831b96eb3878d775be9938455a6a805610aa4e6",
      "new_mode": 33188,
      "new_path": "gdb/python/py-utils.c"
    },
    {
      "type": "modify",
      "old_id": "10c984bad4b0d8351d9d9ac4b8c44990c199187e",
      "old_mode": 33188,
      "old_path": "gdb/python/python-internal.h",
      "new_id": "0cc5fc4ac06692378f2102e11a6514512edb5ce1",
      "new_mode": 33188,
      "new_path": "gdb/python/python-internal.h"
    },
    {
      "type": "modify",
      "old_id": "e6d58f2f16a70cc451f339c207c8c5d160738e7f",
      "old_mode": 33188,
      "old_path": "gdb/python/python.c",
      "new_id": "2131c4a0648e8ed54b3851ba1d0dfbf025011358",
      "new_mode": 33188,
      "new_path": "gdb/python/python.c"
    }
  ]
}
