diff options
Diffstat (limited to 'gdb/solib-target.c')
-rw-r--r-- | gdb/solib-target.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/gdb/solib-target.c b/gdb/solib-target.c index cf569ec..01171f8 100644 --- a/gdb/solib-target.c +++ b/gdb/solib-target.c @@ -248,27 +248,18 @@ static struct so_list * solib_target_current_sos (void) { struct so_list *new_solib, *start = NULL, *last = NULL; - char *library_document; - struct cleanup *old_chain; VEC(lm_info_target_p) *library_list; lm_info_target *info; int ix; /* Fetch the list of shared libraries. */ - library_document = target_read_stralloc (¤t_target, - TARGET_OBJECT_LIBRARIES, - NULL); + gdb::unique_xmalloc_ptr<char> library_document + = target_read_stralloc (¤t_target, TARGET_OBJECT_LIBRARIES, NULL); if (library_document == NULL) return NULL; - /* solib_target_parse_libraries may throw, so we use a cleanup. */ - old_chain = make_cleanup (xfree, library_document); - /* Parse the list. */ - library_list = solib_target_parse_libraries (library_document); - - /* library_document string is not needed behind this point. */ - do_cleanups (old_chain); + library_list = solib_target_parse_libraries (library_document.get ()); if (library_list == NULL) return NULL; |