mirror of
https://gitlab.freedesktop.org/libbsd/libbsd.git
synced 2025-06-03 05:22:08 +02:00
Fix unportable sizeof() usage
We are calculating the size of the array, and need to pass the size of each element, not the size of a pointer to an element. Although this happens to be the same in many cases, this is not a portable assumption. Warned-by: coverity
This commit is contained in:
parent
2fb148a290
commit
5a32ea0a72
@ -118,7 +118,7 @@ sradixsort(const u_char **a, int n, const u_char *tab, u_int endch)
|
|||||||
if (n < THRESHOLD)
|
if (n < THRESHOLD)
|
||||||
simplesort(a, n, 0, tr, endch);
|
simplesort(a, n, 0, tr, endch);
|
||||||
else {
|
else {
|
||||||
ta = reallocarray(NULL, n, sizeof(a));
|
ta = reallocarray(NULL, n, sizeof(*a));
|
||||||
if (ta == NULL)
|
if (ta == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
r_sort_b(a, ta, n, 0, tr, endch);
|
r_sort_b(a, ta, n, 0, tr, endch);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user