summaryrefslogtreecommitdiffstats
path: root/lib/libelf/elf_data.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libelf/elf_data.c')
-rw-r--r--lib/libelf/elf_data.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libelf/elf_data.c b/lib/libelf/elf_data.c
index 9241b09..b8c10de 100644
--- a/lib/libelf/elf_data.c
+++ b/lib/libelf/elf_data.c
@@ -115,8 +115,10 @@ elf_getdata(Elf_Scn *s, Elf_Data *d)
d->d_type = elftype;
d->d_version = e->e_version;
- if (sh_type == SHT_NOBITS)
+ if (sh_type == SHT_NOBITS || sh_size == 0) {
+ STAILQ_INSERT_TAIL(&s->s_data, d, d_next);
return (d);
+ }
if ((d->d_buf = malloc(msz*count)) == NULL) {
(void) _libelf_release_data(d);
OpenPOWER on IntegriCloud