Check malloc succeeded in pic_create, with M_NOWAIT it may return NULL.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Andrew Turner 2016-05-09 12:24:39 +00:00
parent 0754e66c54
commit b48c608386

View File

@ -871,6 +871,10 @@ pic_create(device_t dev, intptr_t xref)
return (pic);
}
pic = malloc(sizeof(*pic), M_INTRNG, M_NOWAIT | M_ZERO);
if (pic == NULL) {
mtx_unlock(&pic_list_lock);
return (NULL);
}
pic->pic_xref = xref;
pic->pic_dev = dev;
SLIST_INSERT_HEAD(&pic_list, pic, pic_next);