Problem
diff_scriptable_object_against_defaults creates a temporary ScriptableObject instance and only destroys it after the diff loop completes successfully.
Evidence
Editor/MCPServerMethods.ScriptableObject.cs:30 creates defaults = ScriptableObject.CreateInstance(so.GetType()).
Editor/MCPServerMethods.ScriptableObject.cs:36-54 serializes and compares properties.
Editor/MCPServerMethods.ScriptableObject.cs:56 destroys defaults, but this is not inside a finally.
Impact
If property serialization/comparison throws, the temporary ScriptableObject remains alive until domain reload. Repeated failing calls can accumulate hidden objects.
Suggested fix
Wrap the diff loop in try/finally and call DestroyImmediate(defaults) in the finally when the instance was created.
Source report
Imported from audit report item: resource-leak (9) / Editor/MCPServerMethods.ScriptableObject.cs:56.
Problem
diff_scriptable_object_against_defaultscreates a temporary ScriptableObject instance and only destroys it after the diff loop completes successfully.Evidence
Editor/MCPServerMethods.ScriptableObject.cs:30createsdefaults = ScriptableObject.CreateInstance(so.GetType()).Editor/MCPServerMethods.ScriptableObject.cs:36-54serializes and compares properties.Editor/MCPServerMethods.ScriptableObject.cs:56destroysdefaults, but this is not inside afinally.Impact
If property serialization/comparison throws, the temporary ScriptableObject remains alive until domain reload. Repeated failing calls can accumulate hidden objects.
Suggested fix
Wrap the diff loop in
try/finallyand callDestroyImmediate(defaults)in thefinallywhen the instance was created.Source report
Imported from audit report item:
resource-leak (9)/Editor/MCPServerMethods.ScriptableObject.cs:56.