Fix issues detected by static analysis tool 31/141431/3
authorJihoon Kim <jihoon48.kim@samsung.com>
Mon, 31 Jul 2017 10:32:25 +0000 (19:32 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 31 Jul 2017 22:42:10 +0000 (22:42 +0000)
Change-Id: I06523a22f94ea8ff53dd9643aa74f90cf93fc671
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
ism/extras/wayland_immodule/wayland_imcontext.c
ism/src/isf_pkg.cpp
ism/src/scim_iconv.cpp
ism/src/scim_socket.cpp
ism/src/scim_transaction.cpp

index 1a90de6..df8b3a7 100644 (file)
@@ -3446,7 +3446,7 @@ wayland_im_context_input_panel_imdata_set(Ecore_IMF_Context *ctx, const void *da
         free(imcontext->imdata);
 
     imcontext->imdata = calloc(1, length);
-    if (imcontext->imdata)
+    if (imcontext->imdata && data)
         memcpy(imcontext->imdata, data, length);
 
     imcontext->imdata_size = length;
index d79568d..ca04a09 100644 (file)
@@ -131,7 +131,7 @@ int isf_pkg_ime_app_list_cb (const pkgmgrinfo_appinfo_h handle, void *user_data)
         }
 
         /* pkgrootpath */
-        ret = pkgmgrinfo_pkginfo_get_root_path (pkginfo_handle, &path);
+        pkgmgrinfo_pkginfo_get_root_path (pkginfo_handle, &path);
     }
 
     ime_db.languages = "en";
index f2c0794..10be7c6 100644 (file)
@@ -69,6 +69,9 @@ IConvert::~IConvert ()
 IConvert &
 IConvert::operator= (const IConvert & iconvert)
 {
+    if (this == &iconvert)
+        return *this;
+
     if (m_impl)
         delete (m_impl);
     m_impl = new IConvertImpl ();
index 15d8e50..3044587 100644 (file)
@@ -176,6 +176,9 @@ public:
     }
 
     SocketAddressImpl & operator = (const SocketAddressImpl &other) {
+        if (this == &other)
+            return *this;
+
         m_family = other.m_family;
         m_address = other.m_address;
         if (m_data)
index 28485df..6660b03 100644 (file)
@@ -790,6 +790,9 @@ TransactionReader::TransactionReader (const TransactionReader &reader)
 TransactionReader &
 TransactionReader::operator = (const TransactionReader &reader)
 {
+    if (this == &reader)
+        return *this;
+
     if (m_impl)
         delete (m_impl);
     m_impl = new TransactionReaderImpl ();