CID 5710: Free cookie in case on error path.

This commit is contained in:
Jérôme Duval 2012-02-02 21:25:33 +01:00
parent a2f89c5843
commit c4d3febeb4

View File

@ -450,8 +450,10 @@ pegasus_device_open(const char *name, uint32 flags,
if ((cookie = malloc (sizeof (driver_cookie))) == NULL)
return B_NO_MEMORY;
if ((err = acquire_sem(device->sem_lock)) != B_OK)
if ((err = acquire_sem(device->sem_lock)) != B_OK) {
free(cookie);
return err;
}
device->nonblocking = (flags & O_NONBLOCK) ? true : false;
cookie->device = device;