diff options
author | Tom Tromey <tom@tromey.com> | 2018-02-06 12:54:44 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-02-08 11:46:57 -0700 |
commit | 58ef3771fbbdf7fd891fceefdd4bf2720c6c1ee7 (patch) | |
tree | 8302b4731290b3420523bf45bd8b50d8b6b4e279 /gdb/build-id.c | |
parent | a9abc4345150a3f3e30da78f8d68c1f9e0198772 (diff) | |
download | gdb-58ef3771fbbdf7fd891fceefdd4bf2720c6c1ee7.zip gdb-58ef3771fbbdf7fd891fceefdd4bf2720c6c1ee7.tar.gz gdb-58ef3771fbbdf7fd891fceefdd4bf2720c6c1ee7.tar.bz2 |
Use unique_xmalloc_ptr in build_id_to_debug_bfd
This changes build_id_to_debug_bfd to use a unique_xmalloc_ptr,
removing a cleanup.
2018-02-08 Tom Tromey <tom@tromey.com>
* build-id.c (build_id_to_debug_bfd): Use unique_xmalloc_ptr.
Diffstat (limited to 'gdb/build-id.c')
-rw-r--r-- | gdb/build-id.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/gdb/build-id.c b/gdb/build-id.c index 945da4f..685a2b0 100644 --- a/gdb/build-id.c +++ b/gdb/build-id.c @@ -95,8 +95,6 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id) const gdb_byte *data = build_id; size_t size = build_id_len; char *s; - char *filename = NULL; - struct cleanup *inner; memcpy (link, debugdir, debugdir_len); s = &link[debugdir_len]; @@ -116,16 +114,15 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id) printf_unfiltered (_(" Trying %s\n"), link); /* lrealpath() is expensive even for the usually non-existent files. */ + gdb::unique_xmalloc_ptr<char> filename; if (access (link, F_OK) == 0) - filename = lrealpath (link); + filename.reset (lrealpath (link)); if (filename == NULL) continue; /* We expect to be silent on the non-existing files. */ - inner = make_cleanup (xfree, filename); - abfd = gdb_bfd_open (filename, gnutarget, -1); - do_cleanups (inner); + abfd = gdb_bfd_open (filename.get (), gnutarget, -1); if (abfd == NULL) continue; |