Do not allocate buffer to hold data for zero-sized sections.
This commit is contained in:
parent
f9ad4da76d
commit
1bc9325f8a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=217833
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user