public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/27607] New: Memory leak in support/support_test_main.c
@ 2021-03-18 18:31 pfrankli at redhat dot com
  2021-03-18 18:34 ` [Bug libc/27607] Memory leak in support/support_test_main.c (run_test_function) pfrankli at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: pfrankli at redhat dot com @ 2021-03-18 18:31 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=27607

            Bug ID: 27607
           Summary: Memory leak in support/support_test_main.c
           Product: glibc
           Version: 2.33
            Status: NEW
          Severity: minor
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: pfrankli at redhat dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

if (wait_for_debugger)
    {
      pid_t mypid;
      FILE *gdb_script;
      char *gdb_script_name;
      int inside_container = 0;

      mypid = getpid();
      if (mypid < 3)
        {
          const char *outside_pid = getenv("PID_OUTSIDE_CONTAINER");
          if (outside_pid)
            {
              mypid = atoi (outside_pid);
              inside_container = 1;
            }
        }

      gdb_script_name = (char *) xmalloc (strlen (argv[0]) + strlen (".gdb") +
1);


We allocate gdb_script_name.

      sprintf (gdb_script_name, "%s.gdb", argv[0]);
      gdb_script = xfopen (gdb_script_name, "w");

      fprintf (stderr, "Waiting for debugger, test process is pid %d\n",
mypid);
      fprintf (stderr, "gdb -x %s\n", gdb_script_name);
      if (inside_container)
        fprintf (gdb_script, "set sysroot %s/testroot.root\n",
support_objdir_root);
      fprintf (gdb_script, "file\n");
      fprintf (gdb_script, "file %s\n", argv[0]);
      fprintf (gdb_script, "symbol-file %s\n", argv[0]);
      fprintf (gdb_script, "exec-file %s\n", argv[0]);
      fprintf (gdb_script, "attach %ld\n", (long int) mypid);
      fprintf (gdb_script, "set wait_for_debugger = 0\n");
      fclose (gdb_script);
    }

Then we go out of scope without freeing gdb_script_name.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug libc/27607] Memory leak in support/support_test_main.c (run_test_function)
  2021-03-18 18:31 [Bug libc/27607] New: Memory leak in support/support_test_main.c pfrankli at redhat dot com
@ 2021-03-18 18:34 ` pfrankli at redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: pfrankli at redhat dot com @ 2021-03-18 18:34 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=27607

Patsy Franklin <pfrankli at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Memory leak in              |Memory leak in
                   |support/support_test_main.c |support/support_test_main.c
                   |                            |(run_test_function)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-18 18:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18 18:31 [Bug libc/27607] New: Memory leak in support/support_test_main.c pfrankli at redhat dot com
2021-03-18 18:34 ` [Bug libc/27607] Memory leak in support/support_test_main.c (run_test_function) pfrankli at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).