PR feedback

This commit is contained in:
Ken Van Hoeylandt 2026-02-06 16:08:23 +01:00
parent f955a0ec5c
commit ef97fbd222
3 changed files with 6 additions and 5 deletions

View File

@ -74,9 +74,11 @@ error_t device_destruct(Device* device) {
auto* internal = device->internal;
if (internal->state.started || internal->state.added) {
unlock_internal(device->internal);
return ERROR_INVALID_STATE;
}
if (!internal->children.empty()) {
unlock_internal(device->internal);
return ERROR_INVALID_STATE;
}
LOG_D(TAG, "destruct %s", device->name);

View File

@ -51,7 +51,7 @@ error_t driver_destruct(Driver* driver) {
}
internal->destroying = true;
// Remove the internal reference before unlocking so it cannot be accidentally locked again
// Nullify internal reference before deletion to prevent use-after-free
driver->internal = nullptr;
delete internal;

View File

@ -1,9 +1,9 @@
#include <vector>
#include <string.h>
#include <cstring>
#include <algorithm>
#include <new>
#include <tactility/concurrent/mutex.h>
#include <tactility/module.h>
#include <new>
#include <vector>
#define TAG "module"
@ -116,4 +116,3 @@ bool module_resolve_symbol_global(const char* symbol_name, uintptr_t* symbol_add
}
}