summaryrefslogtreecommitdiff
path: root/src/modules/evas/engines/gl_common/evas_gl_texture.c
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-08-13 08:49:07 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-08-13 08:49:07 +0900
commit2ac4f520d613543250bae04b9bc149e2f16f2b9a (patch)
tree6bc20f4831697b92515c957fbfa42219673829df /src/modules/evas/engines/gl_common/evas_gl_texture.c
parentc0ca1bcf441249c2a646af1e8a5dcc6c00ad3a74 (diff)
fix resource leak on format lookup fail
so in fixing one CID for a format lookup failing and thus invalid mem access, a possible leak was made in this case. fix that by doing lookup before any allocation and if lookup fails, return there this fixes CID 1230999 1230998 1230997
Diffstat (limited to '')
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_texture.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_texture.c b/src/modules/evas/engines/gl_common/evas_gl_texture.c
index 3ce910052a..1451ac9c58 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_texture.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_texture.c
@@ -951,11 +951,11 @@ evas_gl_common_texture_native_new(Evas_Engine_GL_Context *gc, unsigned int w, un
951 Evas_GL_Texture *tex; 951 Evas_GL_Texture *tex;
952 int lformat; 952 int lformat;
953 953
954 tex = evas_gl_common_texture_alloc(gc, w, h, alpha);
955 if (!tex) return NULL;
956
957 lformat = _evas_gl_texture_search_format(alpha, gc->shared->info.bgra, EVAS_COLORSPACE_ARGB8888); 954 lformat = _evas_gl_texture_search_format(alpha, gc->shared->info.bgra, EVAS_COLORSPACE_ARGB8888);
958 if (lformat < 0) return NULL; 955 if (lformat < 0) return NULL;
956
957 tex = evas_gl_common_texture_alloc(gc, w, h, alpha);
958 if (!tex) return NULL;
959 tex->pt = _pool_tex_native_new(gc, w, h, 959 tex->pt = _pool_tex_native_new(gc, w, h,
960 *matching_format[lformat].intformat, 960 *matching_format[lformat].intformat,
961 *matching_format[lformat].format, 961 *matching_format[lformat].format,
@@ -975,11 +975,11 @@ evas_gl_common_texture_render_new(Evas_Engine_GL_Context *gc, unsigned int w, un
975 Evas_GL_Texture *tex; 975 Evas_GL_Texture *tex;
976 int lformat; 976 int lformat;
977 977
978 tex = evas_gl_common_texture_alloc(gc, w, h, alpha);
979 if (!tex) return NULL;
980
981 lformat = _evas_gl_texture_search_format(alpha, gc->shared->info.bgra, EVAS_COLORSPACE_ARGB8888); 978 lformat = _evas_gl_texture_search_format(alpha, gc->shared->info.bgra, EVAS_COLORSPACE_ARGB8888);
982 if (lformat < 0) return NULL; 979 if (lformat < 0) return NULL;
980
981 tex = evas_gl_common_texture_alloc(gc, w, h, alpha);
982 if (!tex) return NULL;
983 tex->pt = _pool_tex_render_new(gc, w, h, 983 tex->pt = _pool_tex_render_new(gc, w, h,
984 *matching_format[lformat].intformat, 984 *matching_format[lformat].intformat,
985 *matching_format[lformat].format); 985 *matching_format[lformat].format);
@@ -998,11 +998,11 @@ evas_gl_common_texture_dynamic_new(Evas_Engine_GL_Context *gc, Evas_GL_Image *im
998 Evas_GL_Texture *tex; 998 Evas_GL_Texture *tex;
999 int lformat; 999 int lformat;
1000 1000
1001 tex = evas_gl_common_texture_alloc(gc, im->w, im->h, im->alpha);
1002 if (!tex) return NULL;
1003
1004 lformat = _evas_gl_texture_search_format(tex->alpha, gc->shared->info.bgra, EVAS_COLORSPACE_ARGB8888); 1001 lformat = _evas_gl_texture_search_format(tex->alpha, gc->shared->info.bgra, EVAS_COLORSPACE_ARGB8888);
1005 if (lformat < 0) return NULL; 1002 if (lformat < 0) return NULL;
1003
1004 tex = evas_gl_common_texture_alloc(gc, im->w, im->h, im->alpha);
1005 if (!tex) return NULL;
1006 tex->pt = _pool_tex_dynamic_new(gc, tex->w, tex->h, 1006 tex->pt = _pool_tex_dynamic_new(gc, tex->w, tex->h,
1007 *matching_format[lformat].intformat, 1007 *matching_format[lformat].intformat,
1008 *matching_format[lformat].format); 1008 *matching_format[lformat].format);