From: antognolli Date: Mon, 29 Aug 2011 21:20:26 +0000 (+0000) Subject: ecore/ecore_exe - Don't free the event data while we use it. X-Git-Tag: build/2012-07-04.173327~893 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5f6222dad534aa51ce00e0851327ab776b498bf8;p=profile%2Fivi%2Fecore.git ecore/ecore_exe - Don't free the event data while we use it. Since we are memcpying it to a new allocated memory, we can only free it after finishing doing that. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@62970 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/ecore/ecore_exe.c b/src/lib/ecore/ecore_exe.c index 12027bf..07407ef 100644 --- a/src/lib/ecore/ecore_exe.c +++ b/src/lib/ecore/ecore_exe.c @@ -915,19 +915,9 @@ ecore_exe_event_data_get(Ecore_Exe *exe, Ecore_Exe_Flags flags) count++; } } - if (count == 0) /* No lines to send, cancel the event. */ - { - _ecore_exe_event_exe_data_free(NULL, e); - e = NULL; - } - else /* NULL terminate the array, so that people know where the end is. */ - { - e->lines[count].line = NULL; - e->lines[count].size = 0; - } if (i > last) /* Partial line left over, save it for next time. */ { - if (e) e->size = last; + if (count != 0) e->size = last; if (flags & ECORE_EXE_PIPE_READ) { exe->read_data_size = i - last; @@ -941,6 +931,16 @@ ecore_exe_event_data_get(Ecore_Exe *exe, Ecore_Exe_Flags flags) memcpy(exe->error_data_buf, c, exe->error_data_size); } } + if (count == 0) /* No lines to send, cancel the event. */ + { + _ecore_exe_event_exe_data_free(NULL, e); + e = NULL; + } + else /* NULL terminate the array, so that people know where the end is. */ + { + e->lines[count].line = NULL; + e->lines[count].size = 0; + } } }