+2018-02-08 Tom Tromey <tom@tromey.com>
+
+ * build-id.c (build_id_to_debug_bfd): Use unique_xmalloc_ptr.
+
2018-02-08 Tom Tromey <tom@tromey.com>
* source.c (find_source_lines): Use gdb::def_vector.
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];
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;