Use reallocarray() instead of malloc() or realloc()

This commit is contained in:
Guillem Jover
2014-11-03 23:21:52 +01:00
parent 30e328cbf1
commit 32388fe59f
5 changed files with 11 additions and 9 deletions

View File

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