From: Suyeon Hwang Date: Thu, 24 Aug 2017 08:54:51 +0000 (+0900) Subject: [VoiceControl] Fix memory double freed issue X-Git-Tag: preview1-00151~34^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=97572edeced4b6921d6a28274bb0fb1fadcd380f;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [VoiceControl] Fix memory double freed issue Change-Id: I9d1140252f5cc7cb17453ef6fe7beb4c61853a87 Signed-off-by: Suyeon Hwang --- diff --git a/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/VoiceCommandList.cs b/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/VoiceCommandList.cs index 3b9d4ca5d..8573076b2 100755 --- a/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/VoiceCommandList.cs +++ b/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/VoiceCommandList.cs @@ -141,6 +141,7 @@ namespace Tizen.Uix.VoiceControl return null; } + current._ownership = false; return _list[_index]; } } @@ -223,12 +224,12 @@ namespace Tizen.Uix.VoiceControl /// This exception can be due to not supported. public IEnumerable GetAllCommands() { - List commandList = new List(); _callback = (IntPtr vcCommand, IntPtr userData) => { - SafeCommandHandle handle = new SafeCommandHandle(vcCommand); - handle._ownership = false; - commandList.Add(new VoiceCommand(handle)); + if (IntPtr.Zero == vcCommand) { + Log.Error(LogTag, "Invalid command pointer"); + return false; + } return true; }; ErrorCode error = VcCmdListForeachCommands(_handle, _callback, IntPtr.Zero);