[svn merge] r51699
authorHyoyoung Chang <hyoyoung.chang@samsung.com>
Thu, 7 Oct 2010 05:52:04 +0000 (14:52 +0900)
committerHyoyoung Chang <hyoyoung.chang@samsung.com>
Thu, 7 Oct 2010 05:52:04 +0000 (14:52 +0900)
src/lib/embryo_amx.c
src/lib/embryo_str.c

index 2691189..97c0b12 100644 (file)
@@ -2329,9 +2329,9 @@ embryo_parameter_cell_array_push(Embryo_Program *ep, Embryo_Cell *cells, int num
    Embryo_Param *pr;
    Embryo_Cell *cell_array;
 
-   cell_array = malloc(num * sizeof(Embryo_Cell));
    if ((!cells) || (num <= 0))
      return embryo_parameter_cell_push(ep, 0);
+   cell_array = malloc(num * sizeof(Embryo_Cell));
    ep->params_size++;
    if (ep->params_size > ep->params_alloc)
      {
index cd3b942..653ff50 100644 (file)
@@ -439,6 +439,7 @@ _embryo_str_strchr(Embryo_Program *ep, Embryo_Cell *params)
    if (params[0] != (2 * sizeof(Embryo_Cell))) return 0;
    STRGET(ep, s1, params[1]);
    STRGET(ep, s2, params[2]);
+   if ((!s1) || (!s2)) return -1;
    p = strchr(s1, s2[0]);
    if (!p) return -1;
    return (Embryo_Cell)(p - s1);
@@ -454,6 +455,7 @@ _embryo_str_strrchr(Embryo_Program *ep, Embryo_Cell *params)
    if (params[0] != (2 * sizeof(Embryo_Cell))) return 0;
    STRGET(ep, s1, params[1]);
    STRGET(ep, s2, params[2]);
+   if ((!s1) || (!s2)) return -1;
    p = strrchr(s1, s2[0]);
    if (!p) return -1;
    return (Embryo_Cell)(p - s1);