devfs: Fix memory leak

Following r25662 (where devfs was migrated to the new driver architecture),
the issue noted in CID 872 and already fixed in r25643 was reintroduced.
This commit is contained in:
Philippe Saint-Pierre 2011-12-30 20:50:48 -05:00
parent fbbed9473f
commit a42c52c07e
1 changed files with 3 additions and 1 deletions

View File

@ -1164,8 +1164,10 @@ devfs_open(fs_volume* _volume, fs_vnode* _vnode, int openMode,
if (S_ISCHR(vnode->stream.type)) {
BaseDevice* device = vnode->stream.u.dev.device;
status = device->InitDevice();
if (status != B_OK)
if (status != B_OK) {
free(cookie);
return status;
}
char path[B_FILE_NAME_LENGTH];
get_device_name(vnode, path, sizeof(path));