diff options
author | Tom Tromey <tom@tromey.com> | 2018-06-20 15:35:04 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-06-20 21:10:10 -0600 |
commit | 0d0b0ea29af6abc0790d22f843a3d0cb09424a3a (patch) | |
tree | 1e8471fecfd1c30298679c7e45d1fd797c6b2af9 /gdb/ctf.c | |
parent | 6ff79ccd1ca06a4c557ee81b73e0a535b9fd6001 (diff) | |
download | binutils-0d0b0ea29af6abc0790d22f843a3d0cb09424a3a.zip binutils-0d0b0ea29af6abc0790d22f843a3d0cb09424a3a.tar.gz binutils-0d0b0ea29af6abc0790d22f843a3d0cb09424a3a.tar.bz2 |
Fix a memory leak in py-param.c
Mark Wielaard pointed out this memory leak to me:
==17633== 775 bytes in 1 blocks are definitely lost in loss record 13,346 of 13,967
==17633== at 0x4C2DB6B: malloc (vg_replace_malloc.c:299)
==17633== by 0x6652B7: xmalloc (common-utils.c:45)
==17633== by 0xC4C889: xstrdup (xstrdup.c:34)
==17633== by 0x5A71FD: unicode_to_encoded_string(_object*, char const*) (py-utils.c:81)
==17633== by 0x5A73EB: python_string_to_host_string(_object*) (py-utils.c:158)
==17633== by 0x59CC6C: get_doc_string(_object*, _object*) (py-param.c:334)
==17633== by 0x59D2AA: parmpy_init(_object*, _object*, _object*) (py-param.c:728)
The bug here is that parmpy_init is written as though
add_setshow_generic takes ownership of its doc-string arguments.
However, it does not. This patch fixes the bug in a straightforward
way and also applies some missing constification to make the problem
more apparent.
Tested on x86-64 Fedora 26.
gdb/ChangeLog
2018-06-20 Tom Tromey <tom@tromey.com>
* python/py-param.c (add_setshow_generic): Make parameters const.
(parmpy_init): Update.
Diffstat (limited to 'gdb/ctf.c')
0 files changed, 0 insertions, 0 deletions