From b877a0e74ac3364c963f632e05ecb7e9c783f8b8 Mon Sep 17 00:00:00 2001 From: sndev Date: Sat, 10 Jun 2006 16:54:36 +0000 Subject: [PATCH] * use calloc instead of malloc * set *argc = 0 if mem for the *argv cannot be allocated. SVN revision: 23357 --- legacy/ecore/src/lib/ecore_x/ecore_x_icccm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x_icccm.c b/legacy/ecore/src/lib/ecore_x/ecore_x_icccm.c index 0ed2eda792..ef0503be1b 100644 --- a/legacy/ecore/src/lib/ecore_x/ecore_x_icccm.c +++ b/legacy/ecore/src/lib/ecore_x/ecore_x_icccm.c @@ -752,8 +752,12 @@ ecore_x_icccm_command_get(Ecore_X_Window win, int *argc, char ***argv) if (argc) *argc = c; if (argv) { - (*argv) = malloc(c); - if (!*argv) return; + (*argv) = calloc(c, sizeof(char *)); + if (!*argv) + { + *argc = 0; + return; + } for (i = 0; i < c; i++) (*argv)[i] = strdup(v[i]); }