On Tue, Oct 6, 2015 at 4:11 PM, Riku Voipio <riku.voi...@iki.fi> wrote:
> 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) ? Yes, I also thinks the same. Thank you for review. > > > 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 >> { >> > >