Skip to content

Commit 72a891b

Browse files
authored
Merge pull request #1485 from Unity-Technologies/fix-find-method-memory-leak
Fixing memory leak that occurred when crash reporter v2 was introduce…
2 parents 02d5f4b + 274955c commit 72a891b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

mono/metadata/mono-debug.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -671,13 +671,16 @@ find_method (MonoMethod *method, MonoDomain *domain, MonoDebugMethodJitInfo *jit
671671
MonoDebugMethodJitInfo *
672672
mono_debug_find_method (MonoMethod *method, MonoDomain *domain)
673673
{
674-
MonoDebugMethodJitInfo *res = g_new0 (MonoDebugMethodJitInfo, 1);
675-
676674
if (mono_debug_format == MONO_DEBUG_FORMAT_NONE)
677675
return NULL;
678676

677+
MonoDebugMethodJitInfo* res = g_new0(MonoDebugMethodJitInfo, 1);
679678
mono_debugger_lock ();
680-
find_method (method, domain, res);
679+
if (!find_method(method, domain, res))
680+
{
681+
g_free(res);
682+
res = NULL;
683+
}
681684
mono_debugger_unlock ();
682685
return res;
683686
}

0 commit comments

Comments
 (0)