1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-02-02 14:15:46 +01:00

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
2014-05-18 00:56:42 +02:00
committed by Carlos R. Mafra
parent 6f7fa45a99
commit 3aae412588

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);