device_interfaces: Fix memory leak on success.

The module list was closed properly at the end of the function body
(failure case) but not inside the loop on the success case.

CID 605738.
This commit is contained in:
Augustin Cavalier 2017-11-23 17:32:27 +01:00
parent d73993ff20
commit 14fcbb52cd

View File

@ -463,8 +463,10 @@ get_device_interface(const char* name, bool create)
status_t status = module->init_device(name, &device);
if (status == B_OK) {
interface = allocate_device_interface(device, module);
if (interface != NULL)
if (interface != NULL) {
close_module_list(cookie);
return interface;
}
module->uninit_device(device);
}