[Top][All Lists]

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

block of memory being incorrectly freed in objdump

From: Steven Konopa
Subject: block of memory being incorrectly freed in objdump
Date: Tue, 3 Oct 2000 16:29:53 -0400 (EDT)


I have discovered a core dump in objdump, which is part of the binutils package.
I am using version 2.10 compiled with gcc 2.95.1 running on an HP-UX 10.20 box. 
I have tracked down the cause of the core dump and found out it was due to a 
block of memory being incorrectly freed.

The following code (at line 6219, in function som_bfd_free_cached_info, in file
som.c in my copy):

FREE (o->relocation);

should be replaced with

if (o->relocation != NULL)
    bfd_release (o->relocation);
    o->relocation = NULL;
The reason being is that the block of memory that "o->relocation" points to is
allocated using "bfd_zalloc" at around line 4931 in function
som_slurp_reloc_table in som.c.  Function bfd_zalloc calls a function
named "objalloc_alloc".  It would make sense to free this block of memory with
bfd_release, which calls "objalloc_free_block".  It would be wise to check that
any other memory blocks allocated using bfd_alloc or bfd_zalloc is freed using


Steven Konopa
(540) 663-9251

reply via email to

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