summaryrefslogtreecommitdiffstats
path: root/libdwfl/cu.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2020-06-09 18:21:36 +0200
committerMark Wielaard <[email protected]>2020-06-09 18:21:36 +0200
commitc0d643e7d91fc002c9fecd83277c62a0e56ef76f (patch)
tree89b5cf6673baa2cb206fdf245f4e30fe884945ad /libdwfl/cu.c
parent14030673602a4f331f348decd51e5f0160719f0e (diff)
parent5643e037cb7a38ed5d52f50421be706ea8014e3d (diff)
Merge tag 'elfutils-0.177' into mjw/RH-DTSdts-0.177
elfutils 0.177 release Conflicts: libebl/eblopenbackend.c Removed try_dlopen and csky. tests/run-strip-reloc.sh Removed csky tests.
Diffstat (limited to 'libdwfl/cu.c')
-rw-r--r--libdwfl/cu.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libdwfl/cu.c b/libdwfl/cu.c
index 94bfad8d..4de66248 100644
--- a/libdwfl/cu.c
+++ b/libdwfl/cu.c
@@ -83,8 +83,11 @@ addrarange (Dwfl_Module *mod, Dwarf_Addr addr, struct dwfl_arange **arange)
/* Store the final array, which is probably much smaller than before. */
mod->naranges = naranges;
- mod->aranges = (realloc (aranges, naranges * sizeof aranges[0])
- ?: aranges);
+ if (naranges > 0)
+ mod->aranges = (realloc (aranges, naranges * sizeof aranges[0])
+ ?: aranges);
+ else if (aranges != NULL)
+ free (aranges);
mod->lazycu += naranges;
}