Fix use after free in error case. CID 10545.

This commit is contained in:
Michael Lotz 2011-12-12 03:37:58 +01:00
parent 85819ae108
commit 7bdc07318d

View File

@ -224,8 +224,9 @@ usb_printer_device_added(usb_device newDevice, void **cookie)
device->notify = create_sem(0, "usb_printer callback notify");
if (device->notify < B_OK) {
mutex_destroy(&device->lock);
status_t result = device->notify;
free(device);
return device->notify;
return result;
}
mutex_lock(&gDeviceListLock);