public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/30504] New: Memory Leak in ui::ui in top.c:313
@ 2023-06-01  7:27 mengda2020 at iscas dot ac.cn
  2023-06-01 13:30 ` [Bug gdb/30504] " tromey at sourceware dot org
  0 siblings, 1 reply; 2+ messages in thread
From: mengda2020 at iscas dot ac.cn @ 2023-06-01  7:27 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 30504
           Summary: Memory Leak in ui::ui in top.c:313
           Product: gdb
           Version: 13.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: mengda2020 at iscas dot ac.cn
  Target Milestone: ---

Memory leaks occur when run gdb.

# Test Environment

Ubuntu 20.04, 64 bit
version 13.1

# Reproduce steps

1. compile gdb with ASAN
```
$ CFLAGS="-g -O0 -fsanitize=address" CXXFLAGS="-g -O0 -fsanitize=address"
./configure --prefix=`pwd`/install
$ make
```
2. run cmd.(as is only a binary, its content is not important)
```
$ ./gdb --batch-silent as
```

# ASAN report

```
Direct leak of 112 byte(s) in 1 object(s) allocated from:
    #0 0x4e242d in operator new(unsigned long)
(/home/cmd/sp/Dataset/Binutils/binutils_aflpp/install/bin/gdb+0x4e242d)
    #1 0x1de9fa6 in ui::ui(_IO_FILE*, _IO_FILE*, _IO_FILE*)
/home/cmd/sp/Dataset/Binutils/binutils_aflpp/gdb/top.c:313:19
    #2 0x15bec8b in captured_main_1(captured_main_args*)
/home/cmd/sp/Dataset/Binutils/binutils_aflpp/gdb/main.c:676:17
    #3 0x15be28d in captured_main(void*)
/home/cmd/sp/Dataset/Binutils/binutils_aflpp/gdb/main.c:1319:3
    #4 0x15be058 in gdb_main(captured_main_args*)
/home/cmd/sp/Dataset/Binutils/binutils_aflpp/gdb/main.c:1344:7
    #5 0x4e4f12 in main
/home/cmd/sp/Dataset/Binutils/binutils_aflpp/gdb/gdb.c:32:10
    #6 0x7f53b7f14082 in __libc_start_main
/build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16

Direct leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x4e242d in operator new(unsigned long)
(/home/cmd/sp/Dataset/Binutils/binutils_aflpp/install/bin/gdb+0x4e242d)
    #1 0x1dea176 in ui::ui(_IO_FILE*, _IO_FILE*, _IO_FILE*)
/home/cmd/sp/Dataset/Binutils/binutils_aflpp/gdb/top.c:315:19
    #2 0x15bec8b in captured_main_1(captured_main_args*)
/home/cmd/sp/Dataset/Binutils/binutils_aflpp/gdb/main.c:676:17
    #3 0x15be28d in captured_main(void*)
/home/cmd/sp/Dataset/Binutils/binutils_aflpp/gdb/main.c:1319:3
    #4 0x15be058 in gdb_main(captured_main_args*)
/home/cmd/sp/Dataset/Binutils/binutils_aflpp/gdb/main.c:1344:7
    #5 0x4e4f12 in main
/home/cmd/sp/Dataset/Binutils/binutils_aflpp/gdb/gdb.c:32:10
    #6 0x7f53b7f14082 in __libc_start_main
/build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16

Indirect leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x4e242d in operator new(unsigned long)
(/home/cmd/sp/Dataset/Binutils/binutils_aflpp/install/bin/gdb+0x4e242d)
    #1 0x1de9fc1 in ui::ui(_IO_FILE*, _IO_FILE*, _IO_FILE*)
/home/cmd/sp/Dataset/Binutils/binutils_aflpp/gdb/top.c:313:35
    #2 0x15bec8b in captured_main_1(captured_main_args*)
/home/cmd/sp/Dataset/Binutils/binutils_aflpp/gdb/main.c:676:17
    #3 0x15be28d in captured_main(void*)
/home/cmd/sp/Dataset/Binutils/binutils_aflpp/gdb/main.c:1319:3
    #4 0x15be058 in gdb_main(captured_main_args*)
/home/cmd/sp/Dataset/Binutils/binutils_aflpp/gdb/main.c:1344:7
    #5 0x4e4f12 in main
/home/cmd/sp/Dataset/Binutils/binutils_aflpp/gdb/gdb.c:32:10
    #6 0x7f53b7f14082 in __libc_start_main
/build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16

SUMMARY: AddressSanitizer: 208 byte(s) leaked in 3 allocation(s).
```

-- 
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 gdb/30504] Memory Leak in ui::ui in top.c:313
  2023-06-01  7:27 [Bug gdb/30504] New: Memory Leak in ui::ui in top.c:313 mengda2020 at iscas dot ac.cn
@ 2023-06-01 13:30 ` tromey at sourceware dot org
  0 siblings, 0 replies; 2+ messages in thread
From: tromey at sourceware dot org @ 2023-06-01 13:30 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE
                 CC|                            |tromey at sourceware dot org

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
Dup.

*** This bug has been marked as a duplicate of bug 30322 ***

-- 
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:[~2023-06-01 13:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-01  7:27 [Bug gdb/30504] New: Memory Leak in ui::ui in top.c:313 mengda2020 at iscas dot ac.cn
2023-06-01 13:30 ` [Bug gdb/30504] " tromey at sourceware dot org

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).