mirror of
https://gitlab.freedesktop.org/libbsd/libbsd.git
synced 2025-10-21 15:51:46 +02:00
Use reallocarray() instead of malloc() or realloc()
This commit is contained in:
@@ -118,7 +118,8 @@ sradixsort(const u_char **a, int n, const u_char *tab, u_int endch)
|
||||
if (n < THRESHOLD)
|
||||
simplesort(a, n, 0, tr, endch);
|
||||
else {
|
||||
if ((ta = malloc(n * sizeof(a))) == NULL)
|
||||
ta = reallocarray(NULL, n, sizeof(a));
|
||||
if (ta == NULL)
|
||||
return (-1);
|
||||
r_sort_b(a, ta, n, 0, tr, endch);
|
||||
free(ta);
|
||||
|
Reference in New Issue
Block a user