[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2] linux-user: fix memory leak in failure path
From: |
ajia |
Subject: |
[Qemu-devel] [PATCH v2] linux-user: fix memory leak in failure path |
Date: |
Wed, 28 Sep 2011 16:24:41 +0800 |
From: Alex Jia <address@hidden>
Haven't released memory of 'host_mb' in failure path, and calling malloc
allocate
memory to 'host_array', however, memory hasn't been freed before the function
target_to_host_semarray returns.
Signed-off-by: Alex Jia <address@hidden>
---
linux-user/syscall.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 7735008..22d4fcc 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -2466,6 +2466,7 @@ static inline abi_long target_to_host_semarray(int semid,
unsigned short **host_
for(i=0; i<nsems; i++) {
__get_user((*host_array)[i], &array[i]);
}
+ free(*host_array);
unlock_user(array, target_addr, 0);
return 0;
@@ -2779,9 +2780,9 @@ static inline abi_long do_msgrcv(int msqid, abi_long msgp,
}
target_mb->mtype = tswapl(host_mb->mtype);
- free(host_mb);
end:
+ free(host_mb);
if (target_mb)
unlock_user_struct(target_mb, msgp, 1);
return ret;
--
1.7.1
- [Qemu-devel] [PATCH v2] linux-user: fix memory leak in failure path,
ajia <=