Compare the newly allocated array elements to NULL in order to see

if the malloc succeeded.

Spotted by:	reading kernel compile time log
MFC after:	2 weeks
This commit is contained in:
Bjoern A. Zeeb 2015-09-25 23:07:17 +00:00
parent e56a42ab8c
commit 5ddb05c2fe

View File

@ -8075,13 +8075,13 @@ ipf_nat_rehash(softc, t, p)
* the outbound lookup table and the hash chain length for each. * the outbound lookup table and the hash chain length for each.
*/ */
KMALLOCS(newtab[0], nat_t **, newsize * sizeof(nat_t *)); KMALLOCS(newtab[0], nat_t **, newsize * sizeof(nat_t *));
if (newtab == NULL) { if (newtab[0] == NULL) {
error = 60063; error = 60063;
goto badrehash; goto badrehash;
} }
KMALLOCS(newtab[1], nat_t **, newsize * sizeof(nat_t *)); KMALLOCS(newtab[1], nat_t **, newsize * sizeof(nat_t *));
if (newtab == NULL) { if (newtab[1] == NULL) {
error = 60064; error = 60064;
goto badrehash; goto badrehash;
} }