* CID 7: The fObjectArray that holds the usb_id to object association was never

freed.
* Also the allocation of said array was not checked.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27455 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz
2008-09-12 16:48:41 +00:00
parent 67710adc92
commit 8395debafa
@@ -33,6 +33,11 @@ Stack::Stack()
size_t objectArraySize = fObjectMaxCount * sizeof(Object *);
fObjectArray = (Object **)malloc(objectArraySize);
if (fObjectArray == NULL) {
TRACE_ERROR(("USB Stack: failed to allocate object array\n"));
return;
}
memset(fObjectArray, 0, objectArraySize);
fAllocator = new(std::nothrow) PhysicalMemoryAllocator("USB Stack Allocator",
@@ -113,6 +118,7 @@ Stack::~Stack()
}
delete fAllocator;
free(fObjectArray);
}