From: Nguyen Dinh Phi Date: Sun, 17 Mar 2024 17:17:47 +0000 (+0800) Subject: linux-user: replace calloc() with g_new0() X-Git-Tag: v9.0.0-rc3~2^2~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2ee80bce4f7cf2ef78f996ea608755d4e97c94de;p=thirdparty%2Fqemu.git linux-user: replace calloc() with g_new0() Use glib allocation as recommended by the coding convention Signed-off-by: Nguyen Dinh Phi Message-Id: <20240317171747.1642207-1-phind.uet@gmail.com> Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- diff --git a/linux-user/main.c b/linux-user/main.c index 9277df2e9dd..149e35432e8 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -928,11 +928,7 @@ int main(int argc, char **argv, char **envp) * Prepare copy of argv vector for target. */ target_argc = argc - optind; - target_argv = calloc(target_argc + 1, sizeof (char *)); - if (target_argv == NULL) { - (void) fprintf(stderr, "Unable to allocate memory for target_argv\n"); - exit(EXIT_FAILURE); - } + target_argv = g_new0(char *, target_argc + 1); /* * If argv0 is specified (using '-0' switch) we replace