diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-05-12 13:50:05 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-05-12 13:50:09 -0400 |
commit | 4b8cb9dd9e1fa8dc471f640c592312a751e67eed (patch) | |
tree | c1b00367e47618893c8f265e20765a0ab7151d7f /gdb/ChangeLog | |
parent | 3db19b2d7241efde4ca9a7b0e6f33b0929f0cf03 (diff) | |
download | gdb-4b8cb9dd9e1fa8dc471f640c592312a751e67eed.zip gdb-4b8cb9dd9e1fa8dc471f640c592312a751e67eed.tar.gz gdb-4b8cb9dd9e1fa8dc471f640c592312a751e67eed.tar.bz2 |
gdb: make gdbpy_parse_command_name return a unique_xmalloc_ptr
This avoids some manual memory management.
cmdpy_init correctly transfers ownership of the name to the
cmd_list_element, as it sets the name_allocated flag. However,
cmdpy_init (and add_setshow_generic) doesn't, it looks like the name is
just leaked. This is a bit tricky, because it actually creates two
commands (one set and one show), it would take a bit of refactoring of
the command code to give each their own allocated copy. For now, just
keep doing what the current code does but in a more explicit fashion,
with an explicit release.
gdb/ChangeLog:
* python/python-internal.h (gdbpy_parse_command_name): Return
gdb::unique_xmalloc_ptr.
* python/py-cmd.c (gdbpy_parse_command_name): Likewise.
(cmdpy_init): Adjust.
* python/py-param.c (parmpy_init): Adjust.
(add_setshow_generic): Take gdb::unique_xmalloc_ptr, release it
when done.
Change-Id: Iae5bc21fe2b22f12d5f954057b0aca7ca4cd3f0d
Diffstat (limited to 'gdb/ChangeLog')
-rw-r--r-- | gdb/ChangeLog | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d564621..fe75cee 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2021-05-12 Simon Marchi <simon.marchi@polymtl.ca> + + * python/python-internal.h (gdbpy_parse_command_name): Return + gdb::unique_xmalloc_ptr. + * python/py-cmd.c (gdbpy_parse_command_name): Likewise. + (cmdpy_init): Adjust. + * python/py-param.c (parmpy_init): Adjust. + (add_setshow_generic): Take gdb::unique_xmalloc_ptr, release it + when done. + 2021-05-12 George Barrett <bob@bob131.so> * NEWS (Guile API): Note the addition of the new procedure. |