diff options
author | Pedro Alves <palves@redhat.com> | 2017-08-09 15:04:32 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2017-08-09 15:04:32 +0100 |
commit | 29592bde87d250ea56e8431053918899d3d0c16b (patch) | |
tree | 6dc7c4b6f29dcf555f17d7ad1f931e44331e7334 /gdb/cp-support.h | |
parent | b33404388e5bbd8a1fddfde73cd4593ae2b557e8 (diff) | |
download | binutils-gdb-29592bde87d250ea56e8431053918899d3d0c16b.tar.gz |
Make cp_comp_to_string return a gdb::unique_xmalloc_ptr<char>
To help avoid issues like the one fixed by e88e8651cf34 ("Fix memory
leak in cp-support.c").
gdb/ChangeLog:
2017-08-09 Pedro Alves <palves@redhat.com>
* cp-name-parser.y (cp_comp_to_string): Return a
gdb::unique_xmalloc_ptr<char>.
* cp-support.c (replace_typedefs_qualified_name)
(replace_typedefs): Adjust to use gdb::unique_xmalloc_ptr<char>.
(cp_canonicalize_string_full): Use op= instead of explicit
convertion.
(cp_class_name_from_physname, method_name_from_physname)
(cp_func_name, cp_remove_params): Adjust to use
gdb::unique_xmalloc_ptr<char>.
* cp-support.h (cp_comp_to_string): Return a
gdb::unique_xmalloc_ptr<char>.
* python/py-type.c (typy_lookup_type): Adjust to use
gdb::unique_xmalloc_ptr<char>.
Diffstat (limited to 'gdb/cp-support.h')
-rw-r--r-- | gdb/cp-support.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/cp-support.h b/gdb/cp-support.h index 37b281fa54a..9210165cd14 100644 --- a/gdb/cp-support.h +++ b/gdb/cp-support.h @@ -150,8 +150,8 @@ struct type *cp_find_type_baseclass_by_name (struct type *parent_type, extern std::unique_ptr<demangle_parse_info> cp_demangled_name_to_comp (const char *demangled_name, const char **errmsg); -extern char *cp_comp_to_string (struct demangle_component *result, - int estimated_len); +extern gdb::unique_xmalloc_ptr<char> cp_comp_to_string + (struct demangle_component *result, int estimated_len); extern void cp_merge_demangle_parse_infos (struct demangle_parse_info *, struct demangle_component *, |