|
From: | Harmandeep Kaur |
Subject: | Re: [Qemu-devel] [PATCH v4] linux-user/syscall.c: malloc()/calloc() to g_malloc()/g_try_malloc()/g_new0() |
Date: | Tue, 6 Oct 2015 18:17:32 +0530 |
On maanantaina 5. lokakuuta 2015 6.32.27 EEST, Harmandeep Kaur wrote:
Convert malloc()/calloc() calls to g_malloc()/g_try_malloc()/g_new0()
in linux-user/syscall.c file
@@ -7723,7 +7723,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
struct linux_dirent *dirp;
abi_long count = arg3;
- dirp = malloc(count);
+ dirp = g_try_malloc(sizeof(count));
Shouldn't this be g_try_malloc(count) ?
if (!dirp) {
ret = -TARGET_ENOMEM;
goto fail;
@@ -7760,7 +7760,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
ret = count1;
unlock_user(target_dirp, arg2, ret);
}
- free(dirp);
+ g_free(dirp);
}
#else
{
[Prev in Thread] | Current Thread | [Next in Thread] |