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:
Ryan Leavengood 2008-09-12 06:30:07 +00:00
parent 4239ee5d66
commit bf2c508181

View File

@ -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;