From 4a306ec39beeb525ab543acbd60cc28a23ee5aab Mon Sep 17 00:00:00 2001 From: Vitor Sousa Date: Thu, 7 Mar 2019 16:58:26 +0000 Subject: [PATCH] eina_csharp: fix memory leak in Eina.Hash.Set method Reviewed-by: Lauro Neto > Differential Revision: https://phab.enlightenment.org/D8236 --- src/bindings/mono/eina_mono/eina_hash.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bindings/mono/eina_mono/eina_hash.cs b/src/bindings/mono/eina_mono/eina_hash.cs index 4770870c69..95de7c5cb2 100644 --- a/src/bindings/mono/eina_mono/eina_hash.cs +++ b/src/bindings/mono/eina_mono/eina_hash.cs @@ -415,6 +415,8 @@ public class Hash : IEnumerable>, IDi IntPtr old = eina_hash_set(Handle, nk, nv); FreeNativeIndirection(gchnk, ForceRefKey()); FreeNativeIndirection(gchnv, false); + if (OwnValue || old != IntPtr.Zero) + NativeFree(old); } public TValue this[TKey key]