ecore_exe: fix memory leak on realloc.
Summary: Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com> Reviewers: cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D3091 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This commit is contained in:
parent
fc454e4670
commit
826998c15e
|
@ -1095,7 +1095,7 @@ _ecore_exe_data_generic_handler(void *data,
|
|||
if ((fd_handler)
|
||||
&& (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ)))
|
||||
{
|
||||
unsigned char *inbuf;
|
||||
unsigned char *inbuf, *temp;
|
||||
int inbuf_num;
|
||||
|
||||
/* Get any left over data from last time. */
|
||||
|
@ -1135,9 +1135,15 @@ _ecore_exe_data_generic_handler(void *data,
|
|||
}
|
||||
if (num > 0) /* data got read. */
|
||||
{
|
||||
temp = inbuf;
|
||||
inbuf = realloc(inbuf, inbuf_num + num);
|
||||
memcpy(inbuf + inbuf_num, buf, num);
|
||||
inbuf_num += num;
|
||||
if (inbuf)
|
||||
{
|
||||
memcpy(inbuf + inbuf_num, buf, num);
|
||||
inbuf_num += num;
|
||||
}
|
||||
else // realloc fails and returns NULL.
|
||||
inbuf = temp;
|
||||
}
|
||||
else
|
||||
{ /* No more data to read. */
|
||||
|
|
Loading…
Reference in New Issue