Fix prevent issue and accessing null pointer 27/26527/1
authorChangyeon Lee <cyeon.lee@samsung.com>
Thu, 21 Aug 2014 11:24:08 +0000 (20:24 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Tue, 26 Aug 2014 03:54:44 +0000 (12:54 +0900)
Change-Id: Ie5ea161542e0ea6acddc77dd502bca4e091c27d9

src/tbm_bufmgr.c
src/tbm_surface.c
src/tbm_surface_internal.c

index 5f91a4e..f7d8198 100755 (executable)
@@ -790,9 +790,12 @@ static int _tbm_load_module (tbm_bufmgr bufmgr, int fd)
                 if (!ret && strstr (namelist[n]->d_name, PREFIX_LIB))
                 {
                     p = strstr (namelist[n]->d_name, SUFFIX_LIB);
-                    if (!strcmp (p, SUFFIX_LIB))
+                    if (p != NULL)
                     {
-                        ret = _tbm_bufmgr_load_module (bufmgr, fd, namelist[n]->d_name);
+                        if (!strcmp (p, SUFFIX_LIB))
+                        {
+                            ret = _tbm_bufmgr_load_module (bufmgr, fd, namelist[n]->d_name);
+                        }
                     }
                 }
                 free(namelist[n]);
index 546fe28..fb9c710 100755 (executable)
@@ -196,7 +196,7 @@ tbm_surface_get_height (tbm_surface_h surface)
 tbm_format
 tbm_surface_get_format (tbm_surface_h surface)
 {
-    if (surface)
+    if (!surface)
     {
 #ifdef HAVE_CAPI_0_1_1
         set_last_result (TBM_SURFACE_ERROR_INVALID_PARAMETER);
index 6a993b6..fef8118 100755 (executable)
@@ -304,6 +304,7 @@ tbm_surface_internal_create_with_flags (int width, int height, int format, int f
         {
             _deinit_surface_bufmgr ();
             LIST_DELINIT (&g_surface_list);
+            return NULL;
         }
     }
 
@@ -487,7 +488,10 @@ tbm_surface_internal_get_plane_data (tbm_surface_h surface, int plane_idx, uint3
 
     ret = mgr->backend->surface_get_plane_data (surf, surf->info.width, surf->info.height, surf->info.format, plane_idx, size, offset, pitch);
     if (!ret)
+    {
+        pthread_mutex_unlock (&mgr->lock);
         return 0;
+    }
 
     pthread_mutex_unlock (&mgr->lock);