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: nickc at redhat dot com
Subject: [Bug binutils/27797] [size] attempting double-free on bfd/mach-o.c:5978
Date: Fri, 30 Apr 2021 15:42:07 +0000

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

--- Comment #6 from Nick Clifton <nickc at redhat dot com> ---
(In reply to Tom Tromey from comment #5)

Hi Tom,

> I think what realloc does when passed a 0 size is implementation-defined.

Ah - I did wonder about that.


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

Personally I am not too worried about memory leaks.  There are quite a 
few of them still in the sources, but I do not see why they get raised
as issues from tiemn to time.  None of the binutils tools are long 
running, so why worry about a little bit of memory leaking ?  That is
just my opinion though.


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

That is a good idea.  I will try out a patch with that change, and
see if it breaks anything.

Cheers
  Nick

-- 
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]