[binutils-gdb] PR29262, memory leak in pr_function_type

Alan Modra amodra@sourceware.org
Mon Jun 20 01:51:49 GMT 2022


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0d02e70b197c786f26175b9a73f94e01d14abdab

commit 0d02e70b197c786f26175b9a73f94e01d14abdab
Author: Alan Modra <amodra@gmail.com>
Date:   Mon Jun 20 10:39:31 2022 +0930

    PR29262, memory leak in pr_function_type
    
            PR 29262
            * prdbg.c (pr_function_type): Free "s" on failure path.

Diff:
---
 binutils/prdbg.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/binutils/prdbg.c b/binutils/prdbg.c
index c1e41628d26..bb42a5b6c2d 100644
--- a/binutils/prdbg.c
+++ b/binutils/prdbg.c
@@ -742,12 +742,9 @@ pr_function_type (void *p, int argcount, bool varargs)
 
   strcat (s, ")");
 
-  if (! substitute_type (info, s))
-    return false;
-
+  bool ret = substitute_type (info, s);
   free (s);
-
-  return true;
+  return ret;
 }
 
 /* Turn the top type on the stack into a reference to that type.  */


More information about the Binutils-cvs mailing list