aboutsummaryrefslogtreecommitdiff
path: root/binutils/po/fi.po
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2024-11-19 10:37:49 +0000
committerAndrew Burgess <aburgess@redhat.com>2024-11-20 09:33:17 +0000
commit661611b9d71d9358305332d28a8b9d7bb47a4363 (patch)
tree692ee91c06716a98abf5ec118611807d0805d21e /binutils/po/fi.po
parent00ef37e860d505f41a621708c62f3e9363868ee1 (diff)
downloadgdb-master.zip
gdb-master.tar.gz
gdb-master.tar.bz2
gdb/python: fix reference leak in gdb.BreakpointLocation.thread_groupsHEADmaster
While reviewing another patch which uses PyList_Append I took a look at our other uses of PyList_Append in GDB. I spotted something odd about the use in bplocpy_get_thread_groups. We do: gdbpy_ref<> num = gdb_py_object_from_ulongest (inf->num); At which point `num` will own a reference to the `int` object. But when we add the object to the result list we do: if (PyList_Append (list.get (), num.release ()) != 0) return nullptr; By calling `release` we pass ownership of the reference to PyList_Append, however, PyList_Append acquires its own reference, it doesn't take ownership of an existing reference. The consequence of this is that we leak the reference held in `num`. This mostly isn't a problem though. For small (< 257) integers Python keeps a single instance of each and just hands out new references. By leaking the references, these small integers will not be cleaned up as the Python interpreter shuts down, but that is only done when GDB exits, so hardly a disaster. As we're dealing with GDB's internal inferior number here, unless the user has 257+ inferiors, we'll not actually be leaking memory. Still, lets do things right. Switch to using `num.get ()`. Now when `num` goes out of scope it will decrement the reference count as needed. Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'binutils/po/fi.po')
0 files changed, 0 insertions, 0 deletions