ilmControl: fix NULL deref in getPropertiesOfScreen
authorMarcus Fritzsch <marcus.fritzsch@xse.de>
Tue, 22 Jul 2014 11:51:49 +0000 (13:51 +0200)
committerNobuhiko Tanibata <NOBUHIKO_TANIBATA@denso.co.jp>
Tue, 12 Aug 2014 13:15:14 +0000 (22:15 +0900)
Signed-off-by: Marcus Fritzsch <marcus.fritzsch@xse.de>
ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c

index 796878c..2709c6f 100644 (file)
@@ -1513,24 +1513,21 @@ wayland_getPropertiesOfScreen(t_ilm_display screenID,
                               struct ilmScreenProperties* pScreenProperties)
 {
     ilmErrorTypes returnValue = ILM_FAILED;
-    struct ilm_control_context *ctx = sync_and_acquire_instance();
 
-    if (pScreenProperties != NULL) {
-        struct screen_context *ctx_screen = NULL;
-        ctx_screen = get_screen_context_by_id(&ctx->wl, (uint32_t)screenID);
-        if (ctx_screen != NULL) {
-            *pScreenProperties = ctx_screen->prop;
-            create_layerids(ctx_screen, &pScreenProperties->layerIds,
-                                        &pScreenProperties->layerCount);
-            returnValue = ILM_SUCCESS;
-        }
+    if (! pScreenProperties)
+    {
+        return ILM_ERROR_INVALID_ARGUMENTS;
     }
-    else {
-        pScreenProperties->layerCount = 0;
-        pScreenProperties->harwareLayerCount = 0;
-        pScreenProperties->layerIds = NULL;
-        pScreenProperties->screenWidth = 0;
-        pScreenProperties->screenHeight = 0;
+
+    struct ilm_control_context *ctx = sync_and_acquire_instance();
+
+    struct screen_context *ctx_screen = NULL;
+    ctx_screen = get_screen_context_by_id(&ctx->wl, (uint32_t)screenID);
+    if (ctx_screen != NULL) {
+        *pScreenProperties = ctx_screen->prop;
+        create_layerids(ctx_screen, &pScreenProperties->layerIds,
+                                    &pScreenProperties->layerCount);
+        returnValue = ILM_SUCCESS;
     }
 
     release_instance();