Fix svace issue : null dereference and memory leak 43/33543/1
authorWonkeun Oh <wonkeun.oh@samsung.com>
Tue, 27 May 2014 04:12:11 +0000 (13:12 +0900)
committerLi Zhang <li2012.zhang@samsung.com>
Mon, 12 Jan 2015 06:30:55 +0000 (14:30 +0800)
[model] Redwood, B1, B2
[binary_type] PDA
[customer] OPEN
[issue#] N/A
[problem] svace issue: null dereference and memory leak
[cause] null dereference and memory leak
[solution] added null check code and delete object
[team] Input Framework
[request] N/A
[horizontal_expansion] N/A

Change-Id: I01392da5dc06e5e2a0daeef3e73750f882a01185

ism/extras/efl_immodule/isf_imf_context.cpp
ism/modules/frontend/imdkit/i18nClbk.c
ism/src/scim_filter_manager.cpp

index c95512b..91b9e1f 100644 (file)
@@ -3375,7 +3375,7 @@ open_specific_factory (EcoreIMFContextISF *ic,
         }
     } else {
         std::cerr << "open_specific_factory () is failed!!!!!!\n";
-        LOGW ("open_specific_factory () is failed. ic : %x uuid : %s", ic->id, uuid.c_str ());
+        LOGW ("open_specific_factory () is failed. uuid : %s", uuid.c_str ());
 
         // turn_off_ic comment out panel_req_update_factory_info ()
         //turn_off_ic (ic);
index b3edf3a..1e9e96b 100644 (file)
@@ -1,8 +1,8 @@
 /******************************************************************
+
          Copyright 1994, 1995 by Sun Microsystems, Inc.
          Copyright 1993, 1994 by Hewlett-Packard Company
+
 Permission to use, copy, modify, distribute, and sell this software
 and its documentation for any purpose is hereby granted without fee,
 provided that the above copyright notice appear in all copies and
@@ -13,7 +13,7 @@ distribution of the software without specific, written prior permission.
 Sun Microsystems, Inc. and Hewlett-Packard make no representations about
 the suitability of this software for any purpose.  It is provided "as is"
 without express or implied warranty.
+
 SUN MICROSYSTEMS INC. AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL
 WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
 WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
@@ -22,11 +22,11 @@ SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
 RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
 CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
 IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
   Author: Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc.
 
     This version tidied and debugged by Steve Underwood May 1999
+
 ******************************************************************/
 
 #include <X11/Xlib.h>
@@ -70,8 +70,14 @@ int _Xi18nGeometryCallback (XIMS ims, IMProtocol *call_data)
                        0,
                        reply,
                        total_size);
-    FrameMgrFree (fm);
-    XFree (reply);
+    if (fm)
+    {
+        FrameMgrFree (fm);
+    }
+    if (reply)
+    {
+        XFree (reply);
+    }
 
     /* XIM_GEOMETRY is an asyncronous protocol,
        so return immediately. */
@@ -112,8 +118,14 @@ int _Xi18nPreeditStartCallback (XIMS ims, IMProtocol *call_data)
                        0,
                        reply,
                        total_size);
-    FrameMgrFree (fm);
-    XFree (reply);
+    if (fm)
+    {
+        FrameMgrFree (fm);
+    }
+    if (reply)
+    {
+        XFree (reply);
+    }
 
     return True;
 }
@@ -176,15 +188,21 @@ int _Xi18nPreeditDrawCallback (XIMS ims, IMProtocol *call_data)
     for (i = 0;  i < feedback_count;  i++)
         FrameMgrPutToken (fm, draw->text->feedback[i]);
     /*endfor*/
-    
+
     _Xi18nSendMessage (ims,
                        connect_id,
                        XIM_PREEDIT_DRAW,
                        0,
                        reply,
                        total_size);
-    FrameMgrFree (fm);
-    XFree (reply);
+    if (fm)
+    {
+        FrameMgrFree (fm);
+    }
+    if (reply)
+    {
+        XFree (reply);
+    }
 
     /* XIM_PREEDIT_DRAW is an asyncronous protocol, so return immediately. */
     return True;
@@ -230,8 +248,14 @@ int _Xi18nPreeditCaretCallback (XIMS ims, IMProtocol *call_data)
                        0,
                        reply,
                        total_size);
-    FrameMgrFree (fm);
-    XFree (reply);
+    if (fm)
+    {
+        FrameMgrFree (fm);
+    }
+    if (reply)
+    {
+        XFree (reply);
+    }
 
     return True;
 }
@@ -271,8 +295,14 @@ int _Xi18nPreeditDoneCallback (XIMS ims, IMProtocol *call_data)
                        0,
                        reply,
                        total_size);
-    FrameMgrFree (fm);
-    XFree (reply);
+    if (fm)
+    {
+        FrameMgrFree (fm);
+    }
+    if (reply)
+    {
+        XFree (reply);
+    }
 
     /* XIM_PREEDIT_DONE is an asyncronous protocol, so return immediately. */
     return True;
@@ -312,8 +342,14 @@ int _Xi18nStatusStartCallback (XIMS ims, IMProtocol *call_data)
                        0,
                        reply,
                        total_size);
-    FrameMgrFree (fm);
-    XFree (reply);
+    if (fm)
+    {
+        FrameMgrFree (fm);
+    }
+    if (reply)
+    {
+        XFree (reply);
+    }
 
     /* XIM_STATUS_START is an asyncronous protocol, so return immediately. */
     return True;
@@ -348,7 +384,7 @@ int _Xi18nStatusDrawCallback (XIMS ims, IMProtocol *call_data)
         else if (draw->data.text->feedback[0] == 0)
             status = 0x00000002;
         /*endif*/
-        
+
         /* set length of status string */
         FrameMgrSetSize(fm, draw->data.text->length);
         /* set iteration count for list of feedback */
@@ -408,8 +444,14 @@ int _Xi18nStatusDrawCallback (XIMS ims, IMProtocol *call_data)
                        0,
                        reply,
                        total_size);
-    FrameMgrFree (fm);
-    XFree (reply);
+    if (fm)
+    {
+        FrameMgrFree (fm);
+    }
+    if (reply)
+    {
+        XFree (reply);
+    }
 
     /* XIM_STATUS_DRAW is an asyncronous protocol, so return immediately. */
     return True;
@@ -450,8 +492,14 @@ int _Xi18nStatusDoneCallback (XIMS ims, IMProtocol *call_data)
                        0,
                        reply,
                        total_size);
-    FrameMgrFree (fm);
-    XFree (reply);
+    if (fm)
+    {
+        FrameMgrFree (fm);
+    }
+    if (reply)
+    {
+        XFree (reply);
+    }
 
     /* XIM_STATUS_DONE is an asyncronous protocol, so return immediately. */
     return True;
@@ -496,8 +544,14 @@ int _Xi18nStringConversionCallback (XIMS ims, IMProtocol *call_data)
                        0,
                        reply,
                        total_size);
-    FrameMgrFree (fm);
-    XFree (reply);
+    if (fm)
+    {
+        FrameMgrFree (fm);
+    }
+    if (reply)
+    {
+        XFree (reply);
+    }
 
     /* XIM_STR_CONVERSION is a syncronous protocol,
        so should wait here for XIM_STR_CONVERSION_REPLY. */
index 25ab5a1..eeccfb6 100644 (file)
@@ -78,6 +78,7 @@ __initialize_modules (const ConfigPointer &config)
             }
         }
     }
+    delete[] __filter_modules;
 }
 
 class FilterManager::FilterManagerImpl