Fix alloc-dealloc-mismatch defect 86/173786/1
authorJi-hoon Lee <dalton.lee@samsung.com>
Mon, 26 Mar 2018 02:31:48 +0000 (11:31 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Mon, 26 Mar 2018 02:39:41 +0000 (11:39 +0900)
Since the capi callbacks are implemented in C style,
it is more appropriate to use free() instead of
delete / delete[] for releasing the pointer value that contains
dynamically-allocated memory returned from callback funtions.

Change-Id: I26bad5fe5213f1f75e52ec32592369cbd60210b0

ism/src/scim_helper.cpp

index b10a513..4cdada2 100644 (file)
@@ -1098,7 +1098,7 @@ HelperAgent::handle_message (MessageItem *message)
             m_impl->send.put_data (buf, len);
             m_impl->send.write_to_socket (m_impl->socket);
             if (NULL != buf)
-                delete[] buf;
+                free(buf);
             break;
         }
         case ISM_TRANS_CMD_GET_ISE_LANGUAGE_LOCALE:
@@ -1112,7 +1112,7 @@ HelperAgent::handle_message (MessageItem *message)
                 m_impl->send.put_data (buf, strlen (buf));
             m_impl->send.write_to_socket (m_impl->socket);
             if (NULL != buf)
-                delete[] buf;
+                free(buf);
             break;
         }
         case ISM_TRANS_CMD_SET_RETURN_KEY_TYPE:
@@ -2023,7 +2023,7 @@ HelperAgent::update_input_context (uint32 type, uint32 value) const
             m_impl->send.put_data(buf, strlen(buf));
             m_impl->send.write_to_socket(m_impl->socket_active, m_impl->magic_active);
         }
-        delete[] buf;
+        free(buf);
         buf = NULL;
     }