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>
* 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;
}
}
if (free_buf) {
- free(host_ifconf);
+ g_free(host_ifconf);
}
return ret;