No need to crash if we are deleted after not getting far enough to allocate the

configuration buffers.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33122 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2009-09-14 01:22:58 +00:00
parent 8c393635e2
commit 9b0a2ab24c

View File

@ -271,6 +271,13 @@ Device::Device(Object *parent, int8 hubAddress, uint8 hubPort,
Device::~Device() Device::~Device()
{ {
delete fDefaultPipe;
if (fConfigurations == NULL) {
// we didn't get far in device setup, so everything below is unneeded
return;
}
// Destroy open endpoints. Do not send a device request to unconfigure // Destroy open endpoints. Do not send a device request to unconfigure
// though, since we may be deleted because the device was unplugged // though, since we may be deleted because the device was unplugged
// already. // already.
@ -305,7 +312,6 @@ Device::~Device()
} }
free(fConfigurations); free(fConfigurations);
delete fDefaultPipe;
} }