aboutsummaryrefslogtreecommitdiff
path: root/gdb/auxv.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@ericsson.com>2018-08-07 17:43:08 -0400
committerSimon Marchi <simon.marchi@ericsson.com>2018-08-07 17:43:08 -0400
commit528e15722bf67d126e17218708c0314bcfadbf6a (patch)
tree8b17bb0ea9569e150917b27be97b3ecfdc96fe62 /gdb/auxv.c
parent96d68bd48c77fa44e517c3380ee8f224cbce00e5 (diff)
downloadgdb-528e15722bf67d126e17218708c0314bcfadbf6a.zip
gdb-528e15722bf67d126e17218708c0314bcfadbf6a.tar.gz
gdb-528e15722bf67d126e17218708c0314bcfadbf6a.tar.bz2
Replace some uses of xstrprintf with string_printf
This patch replaces some simple uses of xstrprintf with with string_printf, removing the need to do manual memory freeing. The change in ada-lang.c fixes an apparent memory leak. Regtested on the buildbot. gdb/ChangeLog: * common/filestuff.h (gdb_fopen_cloexec): New overload. (gdb_open_cloexec): Likewise. * nat/linux-osdata.c (command_from_pid): Use string_printf. (commandline_from_pid): Likewise. (linux_xfer_osdata_threads): Likewise. (linux_xfer_osdata_fds): Likewise. * ada-lang.c (is_package_name): Likewise. * auxv.c (procfs_xfer_auxv): Likewise. * breakpoint.c (print_one_breakpoint_location): Use uiout::field_fmt. (print_one_catch_solib): Use string_printf. * coff-pe-read.c (add_pe_exported_sym): Likewise. (add_pe_forwarded_sym): Likewise. * dwarf2read.c (create_type_unit_group): Likewise. (build_error_marker_type): Likewise. * infcall.c (get_function_name): Likewise. * valprint.c (print_converted_chars_to_obstack): Likewise. * xtensa-tdep.c (xtensa_register_type): Likewise.
Diffstat (limited to 'gdb/auxv.c')
-rw-r--r--gdb/auxv.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/gdb/auxv.c b/gdb/auxv.c
index dda14f2..13bf9c3 100644
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -46,13 +46,11 @@ procfs_xfer_auxv (gdb_byte *readbuf,
ULONGEST len,
ULONGEST *xfered_len)
{
- char *pathname;
int fd;
ssize_t l;
- pathname = xstrprintf ("/proc/%d/auxv", inferior_ptid.pid ());
+ std::string pathname = string_printf ("/proc/%d/auxv", inferior_ptid.pid ());
fd = gdb_open_cloexec (pathname, writebuf != NULL ? O_WRONLY : O_RDONLY, 0);
- xfree (pathname);
if (fd < 0)
return TARGET_XFER_E_IO;