bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/27797] [size] attempting double-free on bfd/mach-o.c:5978


From: tromey at sourceware dot org
Subject: [Bug binutils/27797] [size] attempting double-free on bfd/mach-o.c:5978
Date: Fri, 30 Apr 2021 15:05:32 +0000

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #5 from Tom Tromey <tromey at sourceware dot org> ---
I didn't see this patch on the mailing list, so I didn't reply there.

I think what realloc does when passed a 0 size is implementation-defined.
It may call free, but it may not.  So, I think some other change is
needed, because with the current code you either get a double free
or a memory leak, depending on the underlying malloc implementation.

One simple thing to do would be like "if (size == 0) size = 1"
to avoid the problem entirely.

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]