raster pushed a commit to branch master.

commit fad576295ed101c746dfdf57d1fe551cdb1d4dd5
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date:   Tue Jul 9 12:18:37 2013 +0900

    somehow buf is freed once its put into an event.. but before event is
    processed. don't allow this.
---
 src/lib/ecore_ipc/ecore_ipc.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/lib/ecore_ipc/ecore_ipc.c b/src/lib/ecore_ipc/ecore_ipc.c
index 9b0efc3..5dfb636 100644
--- a/src/lib/ecore_ipc/ecore_ipc.c
+++ b/src/lib/ecore_ipc/ecore_ipc.c
@@ -1492,6 +1492,12 @@ _ecore_ipc_event_server_data(void *data EINA_UNUSED, int 
ev_type EINA_UNUSED, vo
                                  e2->response = msg.response;
                                  e2->size     = msg.size;
                                  e2->data     = buf;
+                                 if (buf == svr->buf)
+                                   {
+                                      svr->buf = NULL;
+                                      svr->buf_size = 0;
+                                   }
+                                 buf = NULL;
                                  ecore_event_add(ECORE_IPC_EVENT_SERVER_DATA, 
e2,
                                                  
_ecore_ipc_event_server_data_free,
                                                  NULL);
@@ -1500,9 +1506,9 @@ _ecore_ipc_event_server_data(void *data EINA_UNUSED, int 
ev_type EINA_UNUSED, vo
                     }
                   svr->prev.i = msg;
                   offset += (s + msg.size);
-                  if (svr->buf_size == offset)
+                  if ((svr->buf_size == offset) && ((svr->buf) || (buf)))
                     {
-                       free(svr->buf);
+                       if (svr->buf) free(svr->buf);
                        svr->buf = NULL;
                        svr->buf_size = 0;
                        if (buf) free(buf);

-- 

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk

Reply via email to