Invisible Props/Players after time

Hey,

for the last weeks props and players seem to go invisible after time. Now I finally found out what’s causing this.
The following code:



-- fix invisible weapons
local plymeta = FindMetaTable( "Player" )

if oldSpectateEntity == nil then oldSpectateEntity = plymeta.SpectateEntity end
function plymeta:SpectateEntity(ent)
   oldSpectateEntity(self, ent)

    if IsValid(ent) and ent:IsPlayer() then
		local hands = ents.Create( "gmod_hands" )
		if ( IsValid( hands ) ) then
			self:SetHands( hands )
			hands:SetOwner( self )

			local cl_playermodel = self:GetInfo( "cl_playermodel" )
			local info = player_manager.TranslatePlayerHands( cl_playermodel )
			if ( info ) then
				hands:SetModel( info.model )
				hands:SetSkin( info.skin )
				hands:SetBodyGroups( info.body )
			end
			
			local vm = ent:GetViewModel( 0 )
			hands:AttachToViewmodel( vm )

			vm:DeleteOnRemove( hands )
			self:DeleteOnRemove( hands )

			hands:Spawn()
		end
	end
end


This is supposed to be a fix for invisible hands when spectating, it does work, but apparently it causes a memory leak of some sort.
At first: “R_FindDynamicDecalSlot” has no avaiable slot
Then: CUtlLinkedListOverflow (i am aware of the particles bug)

So, what’s wrong with the code above?
Freaky