@@ -20,6 +20,7 @@ namespace locals {
2020std::unordered_map<std::uint32_t , cell_t > associated_handle;
2121std::unordered_map<CGenericClass*, std::vector<std::uint32_t >> class_dynamichooks;
2222std::unordered_set<void **> class_vtables;
23+ SourceMod::HandleSecurity* security = nullptr ;
2324}
2425
2526ParamReturn::ParamReturn (const Capsule* capsule, GeneralRegister* generalregs, FloatRegister* floatregs, void * return_ptr) :
@@ -32,7 +33,9 @@ ParamReturn::ParamReturn(const Capsule* capsule, GeneralRegister* generalregs, F
3233
3334ParamReturn::~ParamReturn () {
3435 if (_handle != BAD_HANDLE) {
35- globals::handlesys->FreeHandle (_handle, nullptr );
36+ if (globals::handlesys->FreeHandle (_handle, locals::security) != SourceMod::HandleError_None) {
37+ globals::sourcemod->LogError (globals::myself, " Failed to delete ParamReturn handle. Contact a Sourcemod dev!" );
38+ }
3639 }
3740}
3841
@@ -324,6 +327,8 @@ class HookSetupDispatch : public SourceMod::IHandleTypeDispatch {
324327HookSetupDispatch gHookSetupDispatcher ;
325328
326329void init () {
330+ locals::security = new SourceMod::HandleSecurity (globals::myself->GetIdentity (), globals::myself->GetIdentity ());
331+
327332 SourceMod::HandleAccess security;
328333 globals::handlesys->InitAccessDefaults (nullptr , &security);
329334 // Do not allow cloning, the struct self-manage its handle
0 commit comments