[SDL_Tizen] Fix svace issue 78/142178/1 accepted/tizen/3.0/common/20170808.135039 accepted/tizen/3.0/mobile/20170808.070452 accepted/tizen/3.0/tv/20170808.070456 submit/tizen_3.0/20170804.060630
authorhuiyu.eun <huiyu.eun@samsung.com>
Wed, 2 Aug 2017 11:24:24 +0000 (20:24 +0900)
committerhuiyu.eun <huiyu.eun@samsung.com>
Thu, 3 Aug 2017 03:06:08 +0000 (12:06 +0900)
Change-Id: If3cf785b1626b77a031409f39de21e642bfef1bc
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
src/video/tizen/SDL_tizenmouse.c
src/video/tizen/SDL_tizenwindow.c

index 371a361..97ae292 100755 (executable)
@@ -137,34 +137,40 @@ Tizen_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y)
         SDL_Window* window = vd->windows;
 
         Tizen_CursorData *data = calloc (1, sizeof (Tizen_CursorData));
-        data->win_data = window->driverdata;
-        cursor->driverdata = (void *) data;
-
-        /* Assume ARGB8888 */
-        SDL_assert(surface->format->format == SDL_PIXELFORMAT_ARGB8888);
-        SDL_assert(surface->pitch == surface->w * 4);
-
-        /* Allocate shared memory buffer for this cursor */
-        if (create_buffer_from_shm (data,
-                                    surface->w,
-                                    surface->h,
-                                    WL_SHM_FORMAT_XRGB8888) < 0)
-        {
-            free (cursor->driverdata);
+        if(data) {
+            data->win_data = window->driverdata;
+            cursor->driverdata = (void *) data;
+
+            /* Assume ARGB8888 */
+            SDL_assert(surface->format->format == SDL_PIXELFORMAT_ARGB8888);
+            SDL_assert(surface->pitch == surface->w * 4);
+
+            /* Allocate shared memory buffer for this cursor */
+            if (create_buffer_from_shm (data,
+                                        surface->w,
+                                        surface->h,
+                                        WL_SHM_FORMAT_XRGB8888) < 0)
+            {
+                free (cursor->driverdata);
+                free (cursor);
+                return NULL;
+            }
+
+            SDL_memcpy(data->shm_data,
+                       surface->pixels,
+                       surface->h * surface->pitch);
+
+            data->surface = wl_compositor_create_surface(ecore_wl_compositor_get());
+
+            data->hot_x = hot_x;
+            data->hot_y = hot_y;
+            data->w = surface->w;
+            data->h = surface->h;
+        }
+        else {
             free (cursor);
             return NULL;
         }
-
-        SDL_memcpy(data->shm_data,
-                   surface->pixels,
-                   surface->h * surface->pitch);
-
-        data->surface = wl_compositor_create_surface(ecore_wl_compositor_get());
-
-        data->hot_x = hot_x;
-        data->hot_y = hot_y;
-        data->w = surface->w;
-        data->h = surface->h;
     }
 
     return cursor;
index 03fa91f..7a11621 100755 (executable)
@@ -69,15 +69,9 @@ _tizen_rotation_type_get()
 
     engine = getenv("SDL_ROTATION");
 
-    if (engine)
-      {
-         if ((!strcasecmp(engine, "normal")))
-            type = ROTATION_TYPE_NORMAL_ROTATION;
-         else if ((!strcasecmp(engine, "pre_rotation")))
-            type = ROTATION_TYPE_PRE_ROTATION;
-         else
-            type = ROTATION_TYPE_PRE_ROTATION;
-      }
+     if (engine && (!strcasecmp(engine, "normal")))
+        type = ROTATION_TYPE_NORMAL_ROTATION;
+
     checked = 1;
     return type;
 }