From 9c506ebc2ebadee922335648539f32b918d869df Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Thu, 24 Aug 2017 17:52:20 +0900 Subject: [PATCH] Fix memory double freed issue Change-Id: I425dcbfcb4be9a3022b5f76d7ebf3d1ff8f6242d Signed-off-by: Suyeon Hwang --- .../Tizen.Uix.VoiceControl/VoiceCommandList.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/VoiceCommandList.cs b/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/VoiceCommandList.cs index 3b9d4ca..8573076 100755 --- a/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/VoiceCommandList.cs +++ b/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); -- 2.7.4