From 3aae4125888d0f678541e69ba5ad9c051e05a268 Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Sun, 18 May 2014 00:56:42 +0200 Subject: [PATCH] WUtil: fix type used in sizeof in function wtokensplit (Coverity #50208 + #50209) As pointed by Coverity, the type used to calculate the size to allocate was not the right one. It now gets the compiler to deduce it from the variable for which the memory is allocated. Signed-off-by: Christophe CURIS --- WINGs/string.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WINGs/string.c b/WINGs/string.c index 5ec333e2..a48d8d7f 100644 --- a/WINGs/string.c +++ b/WINGs/string.c @@ -103,9 +103,9 @@ void wtokensplit(char *command, char ***argv, int *argc) token = wtokennext(line, &line); if (token) { if (count == 0) - *argv = wmalloc(sizeof(char **)); + *argv = wmalloc(sizeof(**argv)); else - *argv = wrealloc(*argv, (count + 1) * sizeof(char **)); + *argv = wrealloc(*argv, (count + 1) * sizeof(**argv)); (*argv)[count++] = token; } } while (token != NULL && line != NULL);