[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 24/27] linux-user/syscall.c: malloc to g_try_malloc
From: |
Laurent Vivier |
Subject: |
[PULL 24/27] linux-user/syscall.c: malloc to g_try_malloc |
Date: |
Thu, 6 Jan 2022 11:41:34 +0100 |
From: Ahmed Abouzied <email@aabouzied.com>
Use g_try_malloc instead of malloc to alocate the target ifconfig.
Also replace the corresponding free with g_free.
Signed-off-by: Ahmed Abouzied <email@aabouzied.com>
Message-Id: <20220104143841.25116-1-email@aabouzied.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
linux-user/syscall.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 3160d77154b5..ce9d64896cb8 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4915,7 +4915,7 @@ static abi_long do_ioctl_ifconf(const IOCTLEntry *ie,
uint8_t *buf_temp,
* We can't fit all the extents into the fixed size buffer.
* Allocate one that is large enough and use it instead.
*/
- host_ifconf = malloc(outbufsz);
+ host_ifconf = g_try_malloc(outbufsz);
if (!host_ifconf) {
return -TARGET_ENOMEM;
}
@@ -4963,7 +4963,7 @@ static abi_long do_ioctl_ifconf(const IOCTLEntry *ie,
uint8_t *buf_temp,
}
if (free_buf) {
- free(host_ifconf);
+ g_free(host_ifconf);
}
return ret;
--
2.33.1
- Re: [PULL 20/27] linux-user/nios2: Map a real kuser page, (continued)
- [PULL 02/27] linux-user/hexagon: Use generic target_stat64 structure, Laurent Vivier, 2022/01/06
- [PULL 16/27] linux-user/syscall.c: fix missed flag for shared memory in open_self_maps, Laurent Vivier, 2022/01/06
- [PULL 27/27] linux-user: netlink: update IFLA_BRPORT entries, Laurent Vivier, 2022/01/06
- [PULL 07/27] linux-user: Split out do_prctl and subroutines, Laurent Vivier, 2022/01/06
- [PULL 25/27] linux-user: netlink: update IFLA entries, Laurent Vivier, 2022/01/06
- [PULL 21/27] linux-user/nios2: Fix EA vs PC confusion, Laurent Vivier, 2022/01/06
- [PULL 08/27] linux-user: Disable more prctl subcodes, Laurent Vivier, 2022/01/06
- [PULL 19/27] linux-user/elfload: Rename ARM_COMMPAGE to HI_COMMPAGE, Laurent Vivier, 2022/01/06
- [PULL 23/27] linux-user/nios2: Use set_sigmask in do_rt_sigreturn, Laurent Vivier, 2022/01/06
- [PULL 24/27] linux-user/syscall.c: malloc to g_try_malloc,
Laurent Vivier <=
- [PULL 05/27] linux-user: target_syscall.h remove definition TARGET_MINSIGSTKSZ, Laurent Vivier, 2022/01/06
- Re: [PULL 00/27] Linux user for 7.0 patches, Richard Henderson, 2022/01/06