aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyen Dinh Phi <phind.uet@gmail.com>2024-03-18 01:17:47 +0800
committerRichard Henderson <richard.henderson@linaro.org>2024-04-09 07:43:31 -1000
commit2ee80bce4f7cf2ef78f996ea608755d4e97c94de (patch)
treef951e72d8d3f850c6f5be6334d7676bd9ef499db
parentf0907ff4cae743f1a4ef3d0a55a047029eed06ff (diff)
linux-user: replace calloc() with g_new0()
Use glib allocation as recommended by the coding convention Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com> Message-Id: <20240317171747.1642207-1-phind.uet@gmail.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r--linux-user/main.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/linux-user/main.c b/linux-user/main.c
index 9277df2e9d..149e35432e 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