cedric pushed a commit to branch master.

commit 5d7689d6274403d00e2c5e34f3d3d10030fc3aae
Author: Jean-Philippe Andre <[email protected]>
Date:   Tue Jun 4 19:54:35 2013 +0900

    evas/cserve2: fix crash in server side when sending SIGINT.
    
    Signed-off-by: Cedric Bail <[email protected]>
---
 src/bin/evas/evas_cserve2_cache.c | 40 ++++++++++++++++++++++-----------------
 1 file changed, 23 insertions(+), 17 deletions(-)

diff --git a/src/bin/evas/evas_cserve2_cache.c 
b/src/bin/evas/evas_cserve2_cache.c
index 2264d09..fb76c55 100644
--- a/src/bin/evas/evas_cserve2_cache.c
+++ b/src/bin/evas/evas_cserve2_cache.c
@@ -1566,7 +1566,7 @@ _glyphs_load_request_response(Glyphs_Request *req, 
Slave_Msg_Font_Glyphs_Loaded
 
         if (!fc)
           {
-             fc = malloc(sizeof(*fc));
+             fc = calloc(1, sizeof(*fc));
              fe->caches = eina_inlist_append(fe->caches, EINA_INLIST_GET(fc));
              fe->last_cache = fc;
              fc->fe = fe;
@@ -1580,22 +1580,28 @@ _glyphs_load_request_response(Glyphs_Request *req, 
Slave_Msg_Font_Glyphs_Loaded
         fc->usage = c->usage;
         for (j = 0; j < c->nglyphs; j++)
           {
-             Glyph_Entry *gl = malloc(sizeof(*gl));
-             gl->fe = fe;
-             gl->fc = fc;
-             gl->index = c->glyphs[j].index;
-             gl->offset = c->glyphs[j].offset;
-             gl->size = c->glyphs[j].size;
-             gl->rows = c->glyphs[j].rows;
-             gl->width = c->glyphs[j].width;
-             gl->pitch = c->glyphs[j].pitch;
-             gl->num_grays = c->glyphs[j].num_grays;
-             gl->pixel_mode = c->glyphs[j].pixel_mode;
-             font_mem_usage += sizeof(*gl);
-             fc->glyphs = eina_inlist_append(fc->glyphs, EINA_INLIST_GET(gl));
-             fc->nglyphs++;
-             fe->nglyphs++;
-             fash_gl_add(fe->glyphs, gl->index, gl);
+             Glyph_Entry *gl;
+
+             gl = fash_gl_find(fe->glyphs, c->glyphs[j].index);
+             if (!gl)
+               {
+                  gl = calloc(1, sizeof(*gl));
+                  gl->fe = fe;
+                  gl->fc = fc;
+                  gl->index = c->glyphs[j].index;
+                  gl->offset = c->glyphs[j].offset;
+                  gl->size = c->glyphs[j].size;
+                  gl->rows = c->glyphs[j].rows;
+                  gl->width = c->glyphs[j].width;
+                  gl->pitch = c->glyphs[j].pitch;
+                  gl->num_grays = c->glyphs[j].num_grays;
+                  gl->pixel_mode = c->glyphs[j].pixel_mode;
+                  font_mem_usage += sizeof(*gl);
+                  fc->glyphs = eina_inlist_append(fc->glyphs, 
EINA_INLIST_GET(gl));
+                  fc->nglyphs++;
+                  fe->nglyphs++;
+                  fash_gl_add(fe->glyphs, gl->index, gl);
+               }
              req->answer[req->nanswer++] = gl;
              gl->fc->inuse++;
           }

-- 

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j

Reply via email to