PUI_ani: free alloacted memory for event which is not added 11/220711/1
authorjeon <jhyuni.kang@samsung.com>
Wed, 18 Sep 2019 07:22:11 +0000 (16:22 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Fri, 20 Dec 2019 09:56:54 +0000 (18:56 +0900)
Change-Id: I788070dffba48065c2ed213a62d40ad8ca3dcc5f

src/PUI_ani.c

index 28db340..325274e 100644 (file)
@@ -296,18 +296,7 @@ pui_ani_status_update(pui_ani_t *ani, pui_ani_status status)
 
        ani_h = ani->ani_h;
 
-       e = (PUI_Event_Animation_Status *)calloc(1, sizeof(PUI_Event_Animation_Status));
-
-       if (!e)
-       {
-               pui_err("Failed to allocate memory for PUI Event !\n");
-               return;
-       }
-
        ani->status = status;
-       e->ani_h = ani_h;
-       e->win = ecore_wl2_window_id_get(ani_h->pui_handle->win);
-       e->status = status;
 
        switch (status)
        {
@@ -337,6 +326,18 @@ pui_ani_status_update(pui_ani_t *ani, pui_ani_status status)
 
        if (ev_type > 0)
        {
+               e = (PUI_Event_Animation_Status *)calloc(1, sizeof(PUI_Event_Animation_Status));
+
+               if (!e)
+               {
+                       pui_err("Failed to allocate memory for PUI Event !\n");
+                       return;
+               }
+
+               e->ani_h = ani_h;
+               e->win = ecore_wl2_window_id_get(ani_h->pui_handle->win);
+               e->status = status;
+
                ecore_event_add(ev_type, e, NULL, ani_h);
        }
 }