summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUma Devika <u.bodapati@samsung.com>2017-07-07 11:48:25 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-07-07 13:22:53 +0900
commitd4ab6ff90a4d5523ef264a29e845780c163fa044 (patch)
tree90a7ac0b33d8aad1caa209c3aee1950f10d83683
parent9aeaef55c4f6791feaddbd6be9c6dbc6e3e0c087 (diff)
Evas and Eolian : Freed string buffer
Summary: Summary : String buffer returned by eina_strbuf_new() is not freed in some cases @Fix Signed-off-by: Uma Devika <u.bodapati@samsung.com> Reviewers: cedric, tasn, jpeg, raster, singh.amitesh Subscribers: tanwar.umesh07, yashu21985, cedric, jpeg Differential Revision: https://phab.enlightenment.org/D5000
-rw-r--r--src/lib/eolian/eo_parser.c2
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_api_ext.c34
-rw-r--r--src/tests/evas/evas_test_image.c2
3 files changed, 26 insertions, 12 deletions
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c
index 5ae3f87..f4bcb83 100644
--- a/src/lib/eolian/eo_parser.c
+++ b/src/lib/eolian/eo_parser.c
@@ -969,6 +969,7 @@ parse_typedef(Eo_Lexer *ls)
969 pop_type(ls); 969 pop_type(ls);
970 check_next(ls, ';'); 970 check_next(ls, ';');
971 FILL_DOC(ls, def, doc); 971 FILL_DOC(ls, def, doc);
972 pop_strbuf(ls);
972 return def; 973 return def;
973} 974}
974 975
@@ -1016,6 +1017,7 @@ parse_variable(Eo_Lexer *ls, Eina_Bool global)
1016 } 1017 }
1017 check_next(ls, ';'); 1018 check_next(ls, ';');
1018 FILL_DOC(ls, def, doc); 1019 FILL_DOC(ls, def, doc);
1020 pop_strbuf(ls);
1019 return def; 1021 return def;
1020} 1022}
1021 1023
diff --git a/src/modules/evas/engines/gl_common/evas_gl_api_ext.c b/src/modules/evas/engines/gl_common/evas_gl_api_ext.c
index f9f4259..1169e79 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_api_ext.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_api_ext.c
@@ -789,6 +789,8 @@ _evgl_api_gles2_ext_init(void *getproc, const char *glueexts)
789 if (!glexts) 789 if (!glexts)
790 { 790 {
791 ERR("glGetString returned NULL! Something is very wrong..."); 791 ERR("glGetString returned NULL! Something is very wrong...");
792 eina_strbuf_free(sb);
793 eina_strbuf_free(sboff);
792 return EINA_FALSE; 794 return EINA_FALSE;
793 } 795 }
794 796
@@ -1033,25 +1035,25 @@ _evgl_api_gles1_ext_init(void *getproc, const char *glueexts)
1033 if (!(rsc=_evgl_tls_resource_get())) 1035 if (!(rsc=_evgl_tls_resource_get()))
1034 { 1036 {
1035 ERR("Unable to initialize GLES1 extensions. Error retrieving tls"); 1037 ERR("Unable to initialize GLES1 extensions. Error retrieving tls");
1036 return EINA_FALSE; 1038 goto error;
1037 } 1039 }
1038 1040
1039 if ((dpy == EGL_NO_DISPLAY) || !rsc->current_ctx) 1041 if ((dpy == EGL_NO_DISPLAY) || !rsc->current_ctx)
1040 { 1042 {
1041 DBG("Unable to initialize GLES1 extensions. Engine not initialized"); 1043 DBG("Unable to initialize GLES1 extensions. Engine not initialized");
1042 return EINA_FALSE; 1044 goto error;
1043 } 1045 }
1044 1046
1045 if (!eglQueryContext(dpy, rsc->current_ctx->context, EGL_CONTEXT_CLIENT_VERSION, &context_version)) 1047 if (!eglQueryContext(dpy, rsc->current_ctx->context, EGL_CONTEXT_CLIENT_VERSION, &context_version))
1046 { 1048 {
1047 ERR("Unable to initialize GLES1 extensions. eglQueryContext failed 0x%x", eglGetError()); 1049 ERR("Unable to initialize GLES1 extensions. eglQueryContext failed 0x%x", eglGetError());
1048 return EINA_FALSE; 1050 goto error;
1049 } 1051 }
1050 1052
1051 if (context_version != EVAS_GL_GLES_1_X) 1053 if (context_version != EVAS_GL_GLES_1_X)
1052 { 1054 {
1053 DBG("GLESv1 context not bound"); 1055 DBG("GLESv1 context not bound");
1054 return EINA_FALSE; 1056 goto error;
1055 } 1057 }
1056#endif 1058#endif
1057 1059
@@ -1059,14 +1061,14 @@ _evgl_api_gles1_ext_init(void *getproc, const char *glueexts)
1059 if (!gles1_funcs || !gles1_funcs->glGetString) 1061 if (!gles1_funcs || !gles1_funcs->glGetString)
1060 { 1062 {
1061 ERR("Could not get address of glGetString in GLESv1 library!"); 1063 ERR("Could not get address of glGetString in GLESv1 library!");
1062 return EINA_FALSE; 1064 goto error;
1063 } 1065 }
1064 1066
1065 glexts = (const char *) gles1_funcs->glGetString(GL_EXTENSIONS); 1067 glexts = (const char *) gles1_funcs->glGetString(GL_EXTENSIONS);
1066 if (!glexts) 1068 if (!glexts)
1067 { 1069 {
1068 ERR("GLESv1:glGetString(GL_EXTENSIONS) returned NULL!"); 1070 ERR("GLESv1:glGetString(GL_EXTENSIONS) returned NULL!");
1069 return EINA_FALSE; 1071 goto error;
1070 } 1072 }
1071 1073
1072 ///////////////////////////////////////////////////////////////////////////////////////////////////// 1074 /////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1226,6 +1228,10 @@ _evgl_api_gles1_ext_init(void *getproc, const char *glueexts)
1226 // GLESv1 version has been initialized! 1228 // GLESv1 version has been initialized!
1227 _evgl_api_ext_status |= EVASGL_API_GLES1_EXT_INITIALIZED; 1229 _evgl_api_ext_status |= EVASGL_API_GLES1_EXT_INITIALIZED;
1228 return EINA_TRUE; 1230 return EINA_TRUE;
1231error:
1232 eina_strbuf_free(sb);
1233 eina_strbuf_free(sboff);
1234 return EINA_FALSE;
1229} 1235}
1230 1236
1231void 1237void
@@ -1317,25 +1323,25 @@ _evgl_api_gles3_ext_init(void *getproc, const char *glueexts)
1317 if (!(rsc=_evgl_tls_resource_get())) 1323 if (!(rsc=_evgl_tls_resource_get()))
1318 { 1324 {
1319 ERR("Unable to initialize GLES3 extensions. Error retrieving tls"); 1325 ERR("Unable to initialize GLES3 extensions. Error retrieving tls");
1320 return EINA_FALSE; 1326 goto error;
1321 } 1327 }
1322 1328
1323 if ((dpy == EGL_NO_DISPLAY) || !rsc->current_ctx) 1329 if ((dpy == EGL_NO_DISPLAY) || !rsc->current_ctx)
1324 { 1330 {
1325 DBG("Unable to initialize GLES3 extensions. Engine not initialized"); 1331 DBG("Unable to initialize GLES3 extensions. Engine not initialized");
1326 return EINA_FALSE; 1332 goto error;
1327 } 1333 }
1328 1334
1329 if (!eglQueryContext(dpy, rsc->current_ctx->context, EGL_CONTEXT_CLIENT_VERSION, &context_version)) 1335 if (!eglQueryContext(dpy, rsc->current_ctx->context, EGL_CONTEXT_CLIENT_VERSION, &context_version))
1330 { 1336 {
1331 ERR("Unable to initialize GLES3 extensions. eglQueryContext failed 0x%x", eglGetError()); 1337 ERR("Unable to initialize GLES3 extensions. eglQueryContext failed 0x%x", eglGetError());
1332 return EINA_FALSE; 1338 goto error;
1333 } 1339 }
1334 1340
1335 if (context_version != EVAS_GL_GLES_3_X) 1341 if (context_version != EVAS_GL_GLES_3_X)
1336 { 1342 {
1337 DBG("GLESv3 context not bound"); 1343 DBG("GLESv3 context not bound");
1338 return EINA_FALSE; 1344 goto error;
1339 } 1345 }
1340#endif 1346#endif
1341 1347
@@ -1344,14 +1350,14 @@ _evgl_api_gles3_ext_init(void *getproc, const char *glueexts)
1344 if (!gles3_funcs || !gles3_funcs->glGetString) 1350 if (!gles3_funcs || !gles3_funcs->glGetString)
1345 { 1351 {
1346 ERR("Could not get address of glGetString in GLESv3 library!"); 1352 ERR("Could not get address of glGetString in GLESv3 library!");
1347 return EINA_FALSE; 1353 goto error;
1348 } 1354 }
1349 1355
1350 glexts = (const char *) gles3_funcs->glGetString(GL_EXTENSIONS); 1356 glexts = (const char *) gles3_funcs->glGetString(GL_EXTENSIONS);
1351 if (!glexts) 1357 if (!glexts)
1352 { 1358 {
1353 ERR("GLESv3:glGetString(GL_EXTENSIONS) returned NULL!"); 1359 ERR("GLESv3:glGetString(GL_EXTENSIONS) returned NULL!");
1354 return EINA_FALSE; 1360 goto error;
1355 } 1361 }
1356 1362
1357 ///////////////////////////////////////////////////////////////////////////////////////////////////// 1363 /////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1510,6 +1516,10 @@ _evgl_api_gles3_ext_init(void *getproc, const char *glueexts)
1510 // GLESv3 version has been initialized! 1516 // GLESv3 version has been initialized!
1511 _evgl_api_ext_status |= EVASGL_API_GLES3_EXT_INITIALIZED; 1517 _evgl_api_ext_status |= EVASGL_API_GLES3_EXT_INITIALIZED;
1512 return EINA_TRUE; 1518 return EINA_TRUE;
1519error:
1520 eina_strbuf_free(sb);
1521 eina_strbuf_free(sboff);
1522 return EINA_FALSE;
1513} 1523}
1514 1524
1515void 1525void
diff --git a/src/tests/evas/evas_test_image.c b/src/tests/evas/evas_test_image.c
index f5bd8c8..c34a52d 100644
--- a/src/tests/evas/evas_test_image.c
+++ b/src/tests/evas/evas_test_image.c
@@ -381,6 +381,8 @@ START_TEST(evas_object_image_tgv_loader_data)
381 evas_object_del(obj); 381 evas_object_del(obj);
382 evas_object_del(ref); 382 evas_object_del(ref);
383 383
384 eina_strbuf_free(str);
385
384 evas_free(e); 386 evas_free(e);
385 evas_shutdown(); 387 evas_shutdown();
386} 388}