Fixed CID 1289: if name cannot be strdup'ed, we should delete entry before
returning B_NO_MEMORY; git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27435 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
4239ee5d66
commit
bf2c508181
@ -45,8 +45,10 @@ DeviceList::AddDevice(const char *name, void *device)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
entry->name = strdup(name);
|
||||
if (entry->name == NULL)
|
||||
if (entry->name == NULL) {
|
||||
delete entry;
|
||||
return B_NO_MEMORY;
|
||||
}
|
||||
|
||||
entry->device = device;
|
||||
entry->next = NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user