support: Free gdb_script_name

Message ID 20210512043704.443470-1-siddhesh@sourceware.org
State New
Headers show
Series
  • support: Free gdb_script_name
Related show

Commit Message

Identified by static analysis.
---
 support/support_test_main.c | 1 +
 1 file changed, 1 insertion(+)

-- 
2.31.1

Comments

Siddhesh Poyarekar via Libc-alpha <libc-alpha@sourceware.org> writes:
> Identified by static analysis.

> ---

>  support/support_test_main.c | 1 +

>  1 file changed, 1 insertion(+)

>

> diff --git a/support/support_test_main.c b/support/support_test_main.c

> index cb72512226..07e3cdd173 100644

> --- a/support/support_test_main.c

> +++ b/support/support_test_main.c

> @@ -221,6 +221,7 @@ run_test_function (int argc, char **argv, const struct test_config *config)

>        fprintf (gdb_script, "attach %ld\n", (long int) mypid);

>        fprintf (gdb_script, "set wait_for_debugger = 0\n");

>        fclose (gdb_script);

> +      free (gdb_script_name);

>      }

>  

>    /* Wait for the debugger to set wait_for_debugger to zero.  */


LGTM.

Reviewed-by: DJ Delorie <dj@redhat.com>

Patch

diff --git a/support/support_test_main.c b/support/support_test_main.c
index cb72512226..07e3cdd173 100644
--- a/support/support_test_main.c
+++ b/support/support_test_main.c
@@ -221,6 +221,7 @@  run_test_function (int argc, char **argv, const struct test_config *config)
       fprintf (gdb_script, "attach %ld\n", (long int) mypid);
       fprintf (gdb_script, "set wait_for_debugger = 0\n");
       fclose (gdb_script);
+      free (gdb_script_name);
     }
 
   /* Wait for the debugger to set wait_for_debugger to zero.  */