From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 79290386EC45; Thu, 18 Mar 2021 18:31:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 79290386EC45 From: "pfrankli at redhat dot com" To: glibc-bugs@sourceware.org Subject: [Bug libc/27607] New: Memory leak in support/support_test_main.c Date: Thu, 18 Mar 2021 18:31:57 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: 2.33 X-Bugzilla-Keywords: X-Bugzilla-Severity: minor X-Bugzilla-Who: pfrankli at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: glibc-bugs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-bugs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 18:31:57 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D27607 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 =3D 0; mypid =3D getpid(); if (mypid < 3) { const char *outside_pid =3D getenv("PID_OUTSIDE_CONTAINER"); if (outside_pid) { mypid =3D atoi (outside_pid); inside_container =3D 1; } } gdb_script_name =3D (char *) xmalloc (strlen (argv[0]) + strlen (".gd= b") + 1); We allocate gdb_script_name. sprintf (gdb_script_name, "%s.gdb", argv[0]); gdb_script =3D 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 =3D 0\n"); fclose (gdb_script); } Then we go out of scope without freeing gdb_script_name. --=20 You are receiving this mail because: You are on the CC list for the bug.=