cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=63ded24f98bb06de1aee8be30ee8cefae532769b

commit 63ded24f98bb06de1aee8be30ee8cefae532769b
Author: Srivardhan Hebbar <sri.heb...@samsung.com>
Date:   Fri Oct 30 07:20:31 2015 +0100

    evas: handling realloc failure in gl_generic.
    
    Summary: Signed-off-by: Srivardhan Hebbar <sri.heb...@samsung.com>
    
    Reviewers: cedric
    
    Differential Revision: https://phab.enlightenment.org/D3236
    
    Signed-off-by: Cedric BAIL <ced...@osg.samsung.com>
---
 src/modules/evas/engines/gl_generic/evas_engine.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c 
b/src/modules/evas/engines/gl_generic/evas_engine.c
index dd1ca90..72acaf6 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -2507,6 +2507,7 @@ eng_ector_begin(void *data EINA_UNUSED, void *context 
EINA_UNUSED, Ector_Surface
    Evas_Engine_GL_Context *gl_context;
    Render_Engine_GL_Generic *re = data;
    int w, h;
+   void *temp;
 
    re->window_use(re->software.ob);
    gl_context = re->window_gl_context_get(re->software.ob);
@@ -2515,7 +2516,14 @@ eng_ector_begin(void *data EINA_UNUSED, void *context 
EINA_UNUSED, Ector_Surface
 
    w = gl_context->w; h = gl_context->h;
 
+   temp = software_buffer;
    software_buffer = realloc(software_buffer, sizeof (unsigned int) * w * h);
+   if (!software_buffer)
+     {
+        ERR("Realloc failed!!");
+        software_buffer = temp;
+        return;
+     }
    memset(software_buffer, 0, sizeof (unsigned int) * w * h);
    if (use_cairo)
      {

-- 


Reply via email to