Fix suspicious use of sizeof(char **), same as sizeof(char *) but not portable.

Coverity CID #56740, #56741, #56742

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson 2014-11-04 23:42:37 +01:00
parent e53ccf61f2
commit 394c4f82a9
2 changed files with 3 additions and 3 deletions

View File

@ -75,7 +75,7 @@ static int FindMatches(char *dir, char *file, char ***avp)
break;
}
if (ac) {
memcpy(word, av, ac * sizeof(char **));
memcpy(word, av, ac * sizeof(char *));
free(av);
}
*avp = av = word;
@ -105,7 +105,7 @@ static int FindMatches(char *dir, char *file, char ***avp)
if ((p = strdup("choices")) != NULL) av[ac++] = p;
} else {
if (ac)
qsort(av, ac, sizeof (char **), compare);
qsort(av, ac, sizeof(char *), compare);
}
return ac;

View File

@ -1576,7 +1576,7 @@ static int argify(char *line, char ***avp)
return ac;
}
memcpy(arg, p, i * sizeof(char **));
memcpy(arg, p, i * sizeof(char *));
i += MEM_INC;
free(p);
*avp = p = arg;