From 9b0a2ab24c6edc25117ce1fd699818a6739ce30a Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Mon, 14 Sep 2009 01:22:58 +0000 Subject: [PATCH] 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 --- src/add-ons/kernel/bus_managers/usb/Device.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/add-ons/kernel/bus_managers/usb/Device.cpp b/src/add-ons/kernel/bus_managers/usb/Device.cpp index 48053d9bc9..1b97065d23 100644 --- a/src/add-ons/kernel/bus_managers/usb/Device.cpp +++ b/src/add-ons/kernel/bus_managers/usb/Device.cpp @@ -271,6 +271,13 @@ Device::Device(Object *parent, int8 hubAddress, uint8 hubPort, 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 // though, since we may be deleted because the device was unplugged // already. @@ -305,7 +312,6 @@ Device::~Device() } free(fConfigurations); - delete fDefaultPipe; }