Protect against trying to free a non-existant peripheral.
Submitted by: Coverity Prevent analysis tool MFC After: 3 days
This commit is contained in:
parent
a47331bb73
commit
661658a6fa
@ -445,6 +445,10 @@ camperiphfree(struct cam_periph *periph)
|
|||||||
if (strcmp((*p_drv)->driver_name, periph->periph_name) == 0)
|
if (strcmp((*p_drv)->driver_name, periph->periph_name) == 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (*p_drv == NULL) {
|
||||||
|
printf("camperiphfree: attempt to free non-existant periph\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (periph->periph_dtor != NULL)
|
if (periph->periph_dtor != NULL)
|
||||||
periph->periph_dtor(periph);
|
periph->periph_dtor(periph);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user