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 <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS authored and Carlos R. Mafra committed 2014-05-18 23:00:16 +01:00
1 parent 6f7fa45a99
commit 3aae412588
1 file changed
+2 -2
+2 -2
View File
@@ -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);