forked from enlightenment/efl
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
This commit is contained in:
parent
c0ca1bcf44
commit
2ac4f520d6
|
@ -951,11 +951,11 @@ evas_gl_common_texture_native_new(Evas_Engine_GL_Context *gc, unsigned int w, un
|
||||||
Evas_GL_Texture *tex;
|
Evas_GL_Texture *tex;
|
||||||
int lformat;
|
int lformat;
|
||||||
|
|
||||||
tex = evas_gl_common_texture_alloc(gc, w, h, alpha);
|
|
||||||
if (!tex) return NULL;
|
|
||||||
|
|
||||||
lformat = _evas_gl_texture_search_format(alpha, gc->shared->info.bgra, EVAS_COLORSPACE_ARGB8888);
|
lformat = _evas_gl_texture_search_format(alpha, gc->shared->info.bgra, EVAS_COLORSPACE_ARGB8888);
|
||||||
if (lformat < 0) return NULL;
|
if (lformat < 0) return NULL;
|
||||||
|
|
||||||
|
tex = evas_gl_common_texture_alloc(gc, w, h, alpha);
|
||||||
|
if (!tex) return NULL;
|
||||||
tex->pt = _pool_tex_native_new(gc, w, h,
|
tex->pt = _pool_tex_native_new(gc, w, h,
|
||||||
*matching_format[lformat].intformat,
|
*matching_format[lformat].intformat,
|
||||||
*matching_format[lformat].format,
|
*matching_format[lformat].format,
|
||||||
|
@ -975,11 +975,11 @@ evas_gl_common_texture_render_new(Evas_Engine_GL_Context *gc, unsigned int w, un
|
||||||
Evas_GL_Texture *tex;
|
Evas_GL_Texture *tex;
|
||||||
int lformat;
|
int lformat;
|
||||||
|
|
||||||
tex = evas_gl_common_texture_alloc(gc, w, h, alpha);
|
|
||||||
if (!tex) return NULL;
|
|
||||||
|
|
||||||
lformat = _evas_gl_texture_search_format(alpha, gc->shared->info.bgra, EVAS_COLORSPACE_ARGB8888);
|
lformat = _evas_gl_texture_search_format(alpha, gc->shared->info.bgra, EVAS_COLORSPACE_ARGB8888);
|
||||||
if (lformat < 0) return NULL;
|
if (lformat < 0) return NULL;
|
||||||
|
|
||||||
|
tex = evas_gl_common_texture_alloc(gc, w, h, alpha);
|
||||||
|
if (!tex) return NULL;
|
||||||
tex->pt = _pool_tex_render_new(gc, w, h,
|
tex->pt = _pool_tex_render_new(gc, w, h,
|
||||||
*matching_format[lformat].intformat,
|
*matching_format[lformat].intformat,
|
||||||
*matching_format[lformat].format);
|
*matching_format[lformat].format);
|
||||||
|
@ -998,11 +998,11 @@ evas_gl_common_texture_dynamic_new(Evas_Engine_GL_Context *gc, Evas_GL_Image *im
|
||||||
Evas_GL_Texture *tex;
|
Evas_GL_Texture *tex;
|
||||||
int lformat;
|
int lformat;
|
||||||
|
|
||||||
tex = evas_gl_common_texture_alloc(gc, im->w, im->h, im->alpha);
|
|
||||||
if (!tex) return NULL;
|
|
||||||
|
|
||||||
lformat = _evas_gl_texture_search_format(tex->alpha, gc->shared->info.bgra, EVAS_COLORSPACE_ARGB8888);
|
lformat = _evas_gl_texture_search_format(tex->alpha, gc->shared->info.bgra, EVAS_COLORSPACE_ARGB8888);
|
||||||
if (lformat < 0) return NULL;
|
if (lformat < 0) return NULL;
|
||||||
|
|
||||||
|
tex = evas_gl_common_texture_alloc(gc, im->w, im->h, im->alpha);
|
||||||
|
if (!tex) return NULL;
|
||||||
tex->pt = _pool_tex_dynamic_new(gc, tex->w, tex->h,
|
tex->pt = _pool_tex_dynamic_new(gc, tex->w, tex->h,
|
||||||
*matching_format[lformat].intformat,
|
*matching_format[lformat].intformat,
|
||||||
*matching_format[lformat].format);
|
*matching_format[lformat].format);
|
||||||
|
|
Loading…
Reference in New Issue