edje: Fix Coverity CID1299026 and CID1299027: Explicit null dereference
authorChris Michael <cp.michael@samsung.com>
Thu, 18 Jun 2015 14:29:06 +0000 (10:29 -0400)
committerChris Michael <cp.michael@samsung.com>
Thu, 18 Jun 2015 14:30:45 +0000 (10:30 -0400)
Summary: Coverity reports that this potentially is passing a NULL
pointer to strcmp. As the GETSTR macro Can possible return NULL we
should be checking that return before passing it to strcmp.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
src/lib/edje/edje_embryo.c

index f3a7400..e05cb0c 100644 (file)
@@ -1100,7 +1100,7 @@ _edje_embryo_fn_set_state_anim(Embryo_Program *ep, Embryo_Cell *params)
         if (HASNPARAMS(6))
           {
              GETSTR(tmp, params[6]);
-             if (!strcmp(tmp, "CURRENT"))
+             if ((tmp) && (!strcmp(tmp, "CURRENT")))
                anim_type |= EDJE_TWEEN_MODE_OPT_FROM_CURRENT;
           }
      }
@@ -1110,7 +1110,7 @@ _edje_embryo_fn_set_state_anim(Embryo_Program *ep, Embryo_Cell *params)
         if (HASNPARAMS(7))
           {
              GETSTR(tmp, params[7]);
-             if (!strcmp(tmp, "CURRENT"))
+             if ((tmp) && (!strcmp(tmp, "CURRENT")))
                anim_type |= EDJE_TWEEN_MODE_OPT_FROM_CURRENT;
           }
         else if (HASNPARAMS(5))
@@ -1126,7 +1126,7 @@ _edje_embryo_fn_set_state_anim(Embryo_Program *ep, Embryo_Cell *params)
         if (HASNPARAMS(8))
           {
              GETSTR(tmp, params[8]);
-             if (!strcmp(tmp, "CURRENT"))
+             if ((tmp) && (!strcmp(tmp, "CURRENT")))
                anim_type |= EDJE_TWEEN_MODE_OPT_FROM_CURRENT;
           }
         else if (HASNPARAMS(5))
@@ -1142,7 +1142,7 @@ _edje_embryo_fn_set_state_anim(Embryo_Program *ep, Embryo_Cell *params)
         if (HASNPARAMS(12))
           {
              GETSTR(tmp, params[8]);
-             if (!strcmp(tmp, "CURRENT"))
+             if ((tmp) && (!strcmp(tmp, "CURRENT")))
                anim_type |= EDJE_TWEEN_MODE_OPT_FROM_CURRENT;
           }
         else if (HASNPARAMS(5))