aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/exec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/exec.c b/src/exec.c
index 5543016..698cb51 100644
--- a/src/exec.c
+++ b/src/exec.c
@@ -506,15 +506,15 @@ prelink_exec (struct prelink_info *info)
{
Elf_Data *data = elf_getdata (dso->scn[j], NULL);
- assert (data->d_buf == NULL);
assert (data->d_size == dso->shdr[j].sh_size);
- data->d_buf = calloc (dso->shdr[j].sh_size, 1);
+ data->d_buf = realloc (data->d_buf, dso->shdr[j].sh_size);
if (data->d_buf == NULL)
{
error (0, ENOMEM, "%s: Could not convert NOBITS section into PROGBITS",
dso->filename);
goto error_out;
}
+ memset (data->d_buf, 0, dso->shdr[j].sh_size);
data->d_type = ELF_T_BYTE;
dso->shdr[j].sh_type = SHT_PROGBITS;
}