]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/solib-svr4: make svr4_info::debug_loader_name an std::string
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 3 Jun 2025 16:45:14 +0000 (12:45 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 5 Jun 2025 15:39:02 +0000 (11:39 -0400)
Remove some manual memory management.

Change-Id: I9c752d35a70e3659509fed57df1c9a8d27ecc742
Approved-By: Tom Tromey <tom@tromey.com>
gdb/solib-svr4.c

index 5a8b08edacda0282af48ae93d2a84bf0c401965b..b7af602c33370113c13db8b6a544c6b3445f3b02 100644 (file)
@@ -368,7 +368,7 @@ struct svr4_info
   CORE_ADDR debug_loader_offset = 0;
 
   /* Name of the dynamic linker, valid if debug_loader_offset_p.  */
-  char *debug_loader_name = nullptr;
+  std::string debug_loader_name;
 
   /* Load map address for the main executable in default namespace.  */
   CORE_ADDR main_lm_addr = 0;
@@ -2681,7 +2681,7 @@ enable_break (struct svr4_info *info, int from_tty)
 
       if (!loader_found_in_list)
        {
-         info->debug_loader_name = xstrdup (interp_name);
+         info->debug_loader_name = interp_name;
          info->debug_loader_offset_p = 1;
          info->debug_loader_offset = load_addr;
          solib_add (NULL, from_tty, auto_solib_add);
@@ -3341,8 +3341,7 @@ svr4_clear_solib (program_space *pspace)
   info->debug_base = 0;
   info->debug_loader_offset_p = 0;
   info->debug_loader_offset = 0;
-  xfree (info->debug_loader_name);
-  info->debug_loader_name = NULL;
+  info->debug_loader_name.clear ();
 }
 
 /* Clear any bits of ADDR that wouldn't fit in a target-format