summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-10-18 13:30:10 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-10-18 13:30:10 -0400
commit20b592cef7f231378f67e0f78d5670144b4d3693 (patch)
tree654a5f275f58ca0b68e5c960f22ad4e5225fc65a
parentc12008b4d0118232aca3f45e3e77137acef75078 (diff)
downloadefl-20b592cef7f231378f67e0f78d5670144b4d3693.tar.gz
fix various trivial null derefs
Summary: CIDs 1401081, 1401044, 1400983, 1400960, 1400927, 1400799, 1396946, 1396944, 1383851, 1383847, 1382211, 1379921, 1379921 Reviewers: cedric Reviewed By: cedric Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10452
-rw-r--r--src/bin/edje/edje_cc_script.c1
-rw-r--r--src/bin/elementary/test_genlist.c4
-rw-r--r--src/examples/elementary/performance/graphical.c5
-rw-r--r--src/examples/elementary/performance/performance.c5
-rw-r--r--src/lib/ecore/efl_loop_handler.c4
-rw-r--r--src/lib/ephysics/ephysics_body.cpp1
-rw-r--r--src/tests/eet/eet_test_common.c3
-rw-r--r--src/tests/eina/eina_test_matrixsparse.c1
-rw-r--r--src/tests/evas/evas_test_mesh.c1
9 files changed, 18 insertions, 7 deletions
diff --git a/src/bin/edje/edje_cc_script.c b/src/bin/edje/edje_cc_script.c
index 2e52ac1c2f..1c972ed7bd 100644
--- a/src/bin/edje/edje_cc_script.c
+++ b/src/bin/edje/edje_cc_script.c
@@ -187,6 +187,7 @@ code_parse_internal(Code *code)
if (tmp->str) free(tmp->str);
free(tmp);
}
+ if (!sym) break;
if ((begin - 1) > body)
{
sym->body = mem_alloc(sizeof(char) * (begin - body - 1));
diff --git a/src/bin/elementary/test_genlist.c b/src/bin/elementary/test_genlist.c
index c3f4d95943..749d04fe63 100644
--- a/src/bin/elementary/test_genlist.c
+++ b/src/bin/elementary/test_genlist.c
@@ -5531,9 +5531,7 @@ test_genlist_show_item(void *data,
g_data->gl = gl;
g_data->itc1 = api->itc1;
- if (g_data)
- max = g_data->max_items;
- else max = 20000;
+ max = g_data->max_items;
for (i = 0; i <= max; i++)
elm_genlist_item_append(gl, api->itc1, (void*)(uintptr_t)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
diff --git a/src/examples/elementary/performance/graphical.c b/src/examples/elementary/performance/graphical.c
index c3a87683b7..d68d865a80 100644
--- a/src/examples/elementary/performance/graphical.c
+++ b/src/examples/elementary/performance/graphical.c
@@ -509,6 +509,11 @@ _xml_attr_data(void *data EINA_UNUSED, const char *key, const char *value)
globalGraphical.model_path = strdup(value);/*Don't forget update UI*/
tmp = strdup(globalGraphical.model_path);
a = strrchr(tmp,'.');
+ if (!a)
+ {
+ free(tmp);
+ return EINA_FALSE;
+ }
format = malloc(sizeof (char) * (strlen(a) - 1));
for (i = 0; i <= (int)strlen(a) - 1; i++)
format[i] = a[i + 1];
diff --git a/src/examples/elementary/performance/performance.c b/src/examples/elementary/performance/performance.c
index 7508a93de1..75f330ccc4 100644
--- a/src/examples/elementary/performance/performance.c
+++ b/src/examples/elementary/performance/performance.c
@@ -516,6 +516,11 @@ _load_mesh(void *data EINA_UNUSED, Evas_Object *obj, void *event_info)
/*Get extension of file*/
tmp = strdup(event_info);
a = strrchr(tmp,'.');
+ if (!a)
+ {
+ free(tmp);
+ return;
+ }
format = malloc(sizeof (char) * (strlen(a) - 1));
for (i = 0; i <= (int)strlen(a) - 1; i++)
format[i] = a[i + 1];
diff --git a/src/lib/ecore/efl_loop_handler.c b/src/lib/ecore/efl_loop_handler.c
index 3bed51396e..4c1034eb00 100644
--- a/src/lib/ecore/efl_loop_handler.c
+++ b/src/lib/ecore/efl_loop_handler.c
@@ -113,7 +113,7 @@ _handler_reset(Eo *obj, Efl_Loop_Handler_Data *pd)
if (pd->handler_fd)
_handler_active_update(obj, pd);
- else
+ else if (pd->loop_data)
{
pd->handler_fd = _ecore_main_fd_handler_add
(pd->loop, pd->loop_data, obj, pd->fd, _handler_flags_get(pd),
@@ -122,7 +122,7 @@ _handler_reset(Eo *obj, Efl_Loop_Handler_Data *pd)
if (pd->handler_fd) _handler_active_update(obj, pd);
}
}
- else if (pd->win32)
+ else if (pd->win32 && pd->loop_data)
{
pd->handler_win32 = _ecore_main_win32_handler_add
(pd->loop, pd->loop_data, obj, pd->win32, _cb_handler_win32, obj);
diff --git a/src/lib/ephysics/ephysics_body.cpp b/src/lib/ephysics/ephysics_body.cpp
index 20b580446a..02c7e8d8c4 100644
--- a/src/lib/ephysics/ephysics_body.cpp
+++ b/src/lib/ephysics/ephysics_body.cpp
@@ -274,6 +274,7 @@ _ephysics_body_soft_body_slice_new(EPhysics_Body *body, double delta, double max
faces = body->soft_body->m_faces;
slice->index = index;
+ if (!faces.size()) return slice;
slice->p[0].x = _ephysics_body_soft_body_slice_calc(
faces[slice->index].m_n[0]->m_x.x(), delta, max);
slice->p[0].y = 1 - _ephysics_body_soft_body_slice_calc(
diff --git a/src/tests/eet/eet_test_common.c b/src/tests/eet/eet_test_common.c
index dba9ab19da..b9011c7be9 100644
--- a/src/tests/eet/eet_test_common.c
+++ b/src/tests/eet/eet_test_common.c
@@ -70,8 +70,7 @@ func7(EINA_UNUSED const Eina_Hash *hash,
val = data;
if (!val)
*res = 1;
-
- if (*val != 7)
+ else if (*val != 7)
*res = 1;
return EINA_TRUE;
diff --git a/src/tests/eina/eina_test_matrixsparse.c b/src/tests/eina/eina_test_matrixsparse.c
index c1aba54f9d..5c8b548508 100644
--- a/src/tests/eina/eina_test_matrixsparse.c
+++ b/src/tests/eina/eina_test_matrixsparse.c
@@ -208,6 +208,7 @@ EFL_START_TEST(eina_test_simple)
fail_if(test1 != NULL);
test1 = eina_matrixsparse_data_idx_get(matrix, 5, 3);
+ fail_if(!test1);
fail_if(*test1 != data[5][3]);
r = eina_matrixsparse_column_idx_clear(matrix, 3);
diff --git a/src/tests/evas/evas_test_mesh.c b/src/tests/evas/evas_test_mesh.c
index d5777ed174..95138e2e1f 100644
--- a/src/tests/evas/evas_test_mesh.c
+++ b/src/tests/evas/evas_test_mesh.c
@@ -92,6 +92,7 @@ return_zero_frame(Evas_Canvas3D_Mesh_Data *pd)
Eina_List *l;
Evas_Canvas3D_Mesh_Frame *f;
+ if (!pd) return NULL;
EINA_LIST_FOREACH(pd->frames, l, f)
{
if (f->frame == 0)