summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorSrivardhan Hebbar <sri.hebbar@samsung.com>2014-12-12 04:22:49 +0100
committerCedric BAIL <cedric@osg.samsung.com>2014-12-12 04:22:54 +0100
commit9792943910fedb834c7ec61f92a17a0810248bc7 (patch)
treef1ac7d312450002db7a76eb5775736993eec9253 /src/bin
parentc501f2ce1117f3a055161f5378da6fbc50c21744 (diff)
edje: use realloc instead of malloc and memcpy.
Summary: Replaced malloc with realloc. Removed free. Added a Error message. Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com> Reviewers: cedric Reviewed By: cedric Subscribers: devilhorns, cedric Differential Revision: https://phab.enlightenment.org/D1766 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'src/bin')
-rwxr-xr-xsrc/bin/edje/edje_cc_out.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c
index 455516bda2..16c02934fd 100755
--- a/src/bin/edje/edje_cc_out.c
+++ b/src/bin/edje/edje_cc_out.c
@@ -1566,13 +1566,20 @@ _edje_lua_script_writer(lua_State *L EINA_UNUSED, const void *chunk_buf, size_t
1566 Script_Lua_Writer *data; 1566 Script_Lua_Writer *data;
1567 void *old; 1567 void *old;
1568 1568
1569
1569 data = (Script_Lua_Writer *)_data; 1570 data = (Script_Lua_Writer *)_data;
1570 old = data->buf; 1571 old = data->buf;
1571 data->buf = malloc(data->size + chunk_size); 1572 data->buf = realloc(data->buf, data->size + chunk_size);
1572 memcpy(data->buf, old, data->size); 1573 if (data->buf)
1573 memcpy(&((data->buf)[data->size]), chunk_buf, chunk_size); 1574 {
1574 if (old) free(old); 1575 memcpy(&((data->buf)[data->size]), chunk_buf, chunk_size);
1575 data->size += chunk_size; 1576 data->size += chunk_size;
1577 }
1578 else
1579 {
1580 ERR("Failed to copy chunk buffer.\n");
1581 data->buf = old;
1582 }
1576 1583
1577 return 0; 1584 return 0;
1578} 1585}