e_policy_visibility: fixed a heap-use-after-free error for the deleted ec when logging accepted/tizen/5.0/unified/20190603.085620 submit/tizen_5.0/20190603.062225
authorGwanglim Lee <gl77.lee@samsung.com>
Fri, 26 Apr 2019 08:15:41 +0000 (17:15 +0900)
committerJuyeon Lee <juyeonne.lee@samsung.com>
Mon, 3 Jun 2019 06:21:35 +0000 (15:21 +0900)
Change-Id: Iae4f57ba35332aa532d187320d93c5e00aa7f4d1

src/bin/e_policy_visibility.c

index 19bb66939bd848895d5ee8a1ffb7023193794cf9..1f3e273de5bf09630e51b720ab0397fd60085932 100644 (file)
@@ -647,8 +647,17 @@ _e_vis_job_exec(Eina_Clist *elem)
 
    _e_vis_clist_unlink(elem);
    job = EINA_CLIST_ENTRY(elem, E_Vis_Job, entry);
+
+   /* After calling the function below, ec may have been deleted.
+    * This is because the delayed ec deletion is perfromed in the following function.
+    * Therefore, be careful when leaving out detailed log message about deleted ec
+    * to avoid segmentation fault error.
+    */
    _e_vis_client_job_exec(job->vc, job->type);
-   VS_INF(job->vc->ec, "FREE JOB:%p, type:%d", job, job->type);
+   if (e_object_is_del(E_OBJECT(job->vc->ec)))
+     INF("VISIBILITY | FREE JOB:%p, type:%d | (ec:%p)", job, job->type, job->vc->ec);
+   else
+     VS_INF(job->vc->ec, "FREE JOB:%p, type:%d", job, job->type);
    E_FREE_FUNC(job->timer, ecore_timer_del);
    free(job);
 }