]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
linux-user/syscall.c: malloc to g_try_malloc
authorAhmed Abouzied <email@aabouzied.com>
Tue, 4 Jan 2022 14:38:41 +0000 (16:38 +0200)
committerLaurent Vivier <laurent@vivier.eu>
Thu, 6 Jan 2022 10:40:52 +0000 (11:40 +0100)
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

index 3160d77154b567d45fefc25e404ad6660071f2d3..ce9d64896cb80e9348f20c1abd897e5d1c529b44 100644 (file)
@@ -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;