cedric pushed a commit to branch master.
commit d2c3b67a72e1b02092909df178193be13a8cb517
Author: Jean-Philippe Andre <[email protected]>
Date: Thu Jun 20 14:38:42 2013 +0900
cserve2: fix minor memleaks with fonts
Leaks happen when fonts fail to load
---
src/lib/evas/common/evas_font_load.c | 16 ++++++++++++++--
src/lib/evas/cserve2/evas_cs2_client.c | 1 +
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/lib/evas/common/evas_font_load.c
b/src/lib/evas/common/evas_font_load.c
index 45cec00..76e0382 100644
--- a/src/lib/evas/common/evas_font_load.c
+++ b/src/lib/evas/common/evas_font_load.c
@@ -355,7 +355,13 @@ evas_common_font_int_memory_load(const char *source, const
char *name, int size,
fi->cs2_handler = evas_cserve2_font_load(source, name, size, font_dpi,
wanted_rend);
if (fi->cs2_handler)
- evas_cserve2_font_load_wait((Font_Entry *)fi->cs2_handler);
+ {
+ if (evas_cserve2_font_load_wait((Font_Entry *)fi->cs2_handler) !=
0)
+ {
+ evas_cserve2_font_free(fi->cs2_handler);
+ fi->cs2_handler = NULL;
+ }
+ }
}
#endif
free(fake_name);
@@ -391,7 +397,13 @@ evas_common_font_int_load(const char *name, int size,
fi->cs2_handler = evas_cserve2_font_load(NULL, name, size, font_dpi,
wanted_rend);
if (fi->cs2_handler)
- evas_cserve2_font_load_wait((Font_Entry *)fi->cs2_handler);
+ {
+ if (evas_cserve2_font_load_wait((Font_Entry *)fi->cs2_handler) !=
0)
+ {
+ evas_cserve2_font_free(fi->cs2_handler);
+ fi->cs2_handler = NULL;
+ }
+ }
}
#endif
// evas_common_font_int_load_complete(fi);
diff --git a/src/lib/evas/cserve2/evas_cs2_client.c
b/src/lib/evas/cserve2/evas_cs2_client.c
index 5830c45..b6aeba6 100644
--- a/src/lib/evas/cserve2/evas_cs2_client.c
+++ b/src/lib/evas/cserve2/evas_cs2_client.c
@@ -1165,6 +1165,7 @@ evas_cserve2_font_free(Font_Entry *fe)
if (ret != CSERVE2_NONE)
{
ERR("Failed to wait loading font '%s'.", fe->name);
+ _font_entry_free(fe);
return;
}
--
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev