Changeset View
Changeset View
Standalone View
Standalone View
sbin/camcontrol/fwdownload.c
Show All 12 Lines | |||||
warnx("Device cannot have media loaded when firmware is " | warnx("Device cannot have media loaded when firmware is " | ||||
"downloaded"); | "downloaded"); | ||||
retval = 1; | retval = 1; | ||||
goto bailout; | goto bailout; | ||||
} | } | ||||
bailout: | bailout: | ||||
if (ccb != NULL) | if (ccb != NULL) | ||||
cam_freeccb(ccb); | cam_freeccb(ccb); | ||||
if (ptr != NULL) | |||||
free(ptr); | |||||
ken: Good catch. Since ptr is always either NULL or malloced memory, you can just pass it in to… | |||||
return (retval); | return (retval); | ||||
} | } | ||||
/* | /* | ||||
* Download firmware stored in buf to cam_dev. If simulation mode | * Download firmware stored in buf to cam_dev. If simulation mode | ||||
* is enabled, only show what packet sizes would be sent to the | * is enabled, only show what packet sizes would be sent to the | ||||
* device but do not sent any actual packets | * device but do not sent any actual packets | ||||
*/ | */ | ||||
Show All 11 Lines |
Good catch. Since ptr is always either NULL or malloced memory, you can just pass it in to free(3) without the if statement. (free(3) will do nothing if the pointer is NULL.)