Protect against trying to free a non-existant peripheral.

Submitted by: Coverity Prevent analysis tool
MFC After: 3 days
This commit is contained in:
Scott Long 2005-02-20 23:45:49 +00:00
parent a47331bb73
commit 661658a6fa

View File

@ -445,6 +445,10 @@ camperiphfree(struct cam_periph *periph)
if (strcmp((*p_drv)->driver_name, periph->periph_name) == 0)
break;
}
if (*p_drv == NULL) {
printf("camperiphfree: attempt to free non-existant periph\n");
return;
}
if (periph->periph_dtor != NULL)
periph->periph_dtor(periph);