Do not leak the delegate, as suggested by Stippi
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30355 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
2384ec2866
commit
6971db8cca
@ -34,24 +34,34 @@
|
||||
LocalDeviceImpl*
|
||||
LocalDeviceImpl::CreateControllerAccessor(BPath* path)
|
||||
{
|
||||
HCIDelegate* hd = new (std::nothrow)HCIControllerAccessor(path);
|
||||
|
||||
if (hd != NULL)
|
||||
return new (std::nothrow)LocalDeviceImpl(hd);
|
||||
else
|
||||
HCIDelegate* delegate = new(std::nothrow) HCIControllerAccessor(path);
|
||||
if (delegate == NULL)
|
||||
return NULL;
|
||||
|
||||
LocalDeviceImpl* device = new(std::nothrow) LocalDeviceImpl(delegate);
|
||||
if (device == NULL) {
|
||||
delete delegate;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return device;
|
||||
}
|
||||
|
||||
|
||||
LocalDeviceImpl*
|
||||
LocalDeviceImpl::CreateTransportAccessor(BPath* path)
|
||||
{
|
||||
HCIDelegate* hd = new (std::nothrow)HCITransportAccessor(path);
|
||||
|
||||
if (hd != NULL)
|
||||
return new (std::nothrow)LocalDeviceImpl(hd);
|
||||
else
|
||||
HCIDelegate* delegate = new(std::nothrow) HCITransportAccessor(path);
|
||||
if (delegate == NULL)
|
||||
return NULL;
|
||||
|
||||
LocalDeviceImpl* device = new(std::nothrow) LocalDeviceImpl(delegate);
|
||||
if (device == NULL) {
|
||||
delete delegate;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return device;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user