Return unique_xmalloc_ptr from call_site_find_chain
[deliverable/binutils-gdb.git] / gdb / dwarf2 / loc.c
index 7f27e453b30347e50f9b2673615162f7635c85a3..a9523e9f7ee400a4505443ad489cacba8dc976fa 100644 (file)
@@ -1091,11 +1091,10 @@ chain_candidate (struct gdbarch *gdbarch,
 /* Create and return call_site_chain for CALLER_PC and CALLEE_PC.  All the
    assumed frames between them use GDBARCH.  Use depth first search so we can
    keep single CHAIN of call_site's back to CALLER_PC.  Function recursion
-   would have needless GDB stack overhead.  Caller is responsible for xfree of
-   the returned result.  Any unreliability results in thrown
-   NO_ENTRY_VALUE_ERROR.  */
+   would have needless GDB stack overhead.  Any unreliability results
+   in thrown NO_ENTRY_VALUE_ERROR.  */
 
-static struct call_site_chain *
+static gdb::unique_xmalloc_ptr<call_site_chain>
 call_site_find_chain_1 (struct gdbarch *gdbarch, CORE_ADDR caller_pc,
                        CORE_ADDR callee_pc)
 {
@@ -1210,19 +1209,18 @@ call_site_find_chain_1 (struct gdbarch *gdbarch, CORE_ADDR caller_pc,
                   paddress (gdbarch, callee_pc));
     }
 
-  return retval.release ();
+  return retval;
 }
 
 /* Create and return call_site_chain for CALLER_PC and CALLEE_PC.  All the
    assumed frames between them use GDBARCH.  If valid call_site_chain cannot be
-   constructed return NULL.  Caller is responsible for xfree of the returned
-   result.  */
+   constructed return NULL.  */
 
-struct call_site_chain *
+gdb::unique_xmalloc_ptr<call_site_chain>
 call_site_find_chain (struct gdbarch *gdbarch, CORE_ADDR caller_pc,
                      CORE_ADDR callee_pc)
 {
-  struct call_site_chain *retval = NULL;
+  gdb::unique_xmalloc_ptr<call_site_chain> retval;
 
   try
     {
This page took 0.025246 seconds and 4 git commands to generate.