diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2014-02-21 11:47:28 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2014-02-21 11:47:28 +0000 |
commit | 9bd9d5e3573ea0465b8eb5700e867674054d27f3 (patch) | |
tree | bf6a3d41697b14986a0b690d9ad0aec868e5f236 /linux-user/elfload.c | |
parent | 774d566cdbebb916af9760dac629aa7c1adf9d3d (diff) | |
parent | 69d4c703a549f0630793a67b16a8fc6bc14c8654 (diff) | |
download | hqemu-9bd9d5e3573ea0465b8eb5700e867674054d27f3.zip hqemu-9bd9d5e3573ea0465b8eb5700e867674054d27f3.tar.gz |
Merge remote-tracking branch 'remotes/riku/linux-user-for-upstream' into staging
* remotes/riku/linux-user-for-upstream:
linux-user: Fix error handling in target_to_host_semarray()
linux-user: Implement BLKPG ioctl
linux-user: Fix error handling in lock_iovec()
linux-user/signal.c: Don't pass sigaction uninitialised sa_flags
linux-user/elfload.c: Avoid calling g_free() on uninitialized data
linux-user: sync syscall numbers upto 3.13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'linux-user/elfload.c')
-rw-r--r-- | linux-user/elfload.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 5902f16..c0687e3 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2636,6 +2636,16 @@ static void fill_thread_info(struct elf_note_info *info, const CPUArchState *env info->notes_size += note_size(&ets->notes[0]); } +static void init_note_info(struct elf_note_info *info) +{ + /* Initialize the elf_note_info structure so that it is at + * least safe to call free_note_info() on it. Must be + * called before calling fill_note_info(). + */ + memset(info, 0, sizeof (*info)); + QTAILQ_INIT(&info->thread_list); +} + static int fill_note_info(struct elf_note_info *info, long signr, const CPUArchState *env) { @@ -2644,10 +2654,6 @@ static int fill_note_info(struct elf_note_info *info, TaskState *ts = (TaskState *)env->opaque; int i; - (void) memset(info, 0, sizeof (*info)); - - QTAILQ_INIT(&info->thread_list); - info->notes = g_malloc0(NUMNOTES * sizeof (struct memelfnote)); if (info->notes == NULL) return (-ENOMEM); @@ -2781,6 +2787,8 @@ static int elf_core_dump(int signr, const CPUArchState *env) int segs = 0; int fd = -1; + init_note_info(&info); + errno = 0; getrlimit(RLIMIT_CORE, &dumpsize); if (dumpsize.rlim_cur == 0) |