* 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:
@@ -33,6 +33,11 @@ Stack::Stack()
|
|||||||
|
|
||||||
size_t objectArraySize = fObjectMaxCount * sizeof(Object *);
|
size_t objectArraySize = fObjectMaxCount * sizeof(Object *);
|
||||||
fObjectArray = (Object **)malloc(objectArraySize);
|
fObjectArray = (Object **)malloc(objectArraySize);
|
||||||
|
if (fObjectArray == NULL) {
|
||||||
|
TRACE_ERROR(("USB Stack: failed to allocate object array\n"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
memset(fObjectArray, 0, objectArraySize);
|
memset(fObjectArray, 0, objectArraySize);
|
||||||
|
|
||||||
fAllocator = new(std::nothrow) PhysicalMemoryAllocator("USB Stack Allocator",
|
fAllocator = new(std::nothrow) PhysicalMemoryAllocator("USB Stack Allocator",
|
||||||
@@ -113,6 +118,7 @@ Stack::~Stack()
|
|||||||
}
|
}
|
||||||
|
|
||||||
delete fAllocator;
|
delete fAllocator;
|
||||||
|
free(fObjectArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user