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)
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 2e52ac1..1c972ed 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)
187 if (tmp->str) free(tmp->str); 187 if (tmp->str) free(tmp->str);
188 free(tmp); 188 free(tmp);
189 } 189 }
190 if (!sym) break;
190 if ((begin - 1) > body) 191 if ((begin - 1) > body)
191 { 192 {
192 sym->body = mem_alloc(sizeof(char) * (begin - body - 1)); 193 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 c3f4d95..749d04f 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,
5531 g_data->gl = gl; 5531 g_data->gl = gl;
5532 g_data->itc1 = api->itc1; 5532 g_data->itc1 = api->itc1;
5533 5533
5534 if (g_data) 5534 max = g_data->max_items;
5535 max = g_data->max_items;
5536 else max = 20000;
5537 for (i = 0; i <= max; i++) 5535 for (i = 0; i <= max; i++)
5538 elm_genlist_item_append(gl, api->itc1, (void*)(uintptr_t)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); 5536 elm_genlist_item_append(gl, api->itc1, (void*)(uintptr_t)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
5539 5537
diff --git a/src/examples/elementary/performance/graphical.c b/src/examples/elementary/performance/graphical.c
index c3a8768..d68d865 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)
509 globalGraphical.model_path = strdup(value);/*Don't forget update UI*/ 509 globalGraphical.model_path = strdup(value);/*Don't forget update UI*/
510 tmp = strdup(globalGraphical.model_path); 510 tmp = strdup(globalGraphical.model_path);
511 a = strrchr(tmp,'.'); 511 a = strrchr(tmp,'.');
512 if (!a)
513 {
514 free(tmp);
515 return EINA_FALSE;
516 }
512 format = malloc(sizeof (char) * (strlen(a) - 1)); 517 format = malloc(sizeof (char) * (strlen(a) - 1));
513 for (i = 0; i <= (int)strlen(a) - 1; i++) 518 for (i = 0; i <= (int)strlen(a) - 1; i++)
514 format[i] = a[i + 1]; 519 format[i] = a[i + 1];
diff --git a/src/examples/elementary/performance/performance.c b/src/examples/elementary/performance/performance.c
index 7508a93..75f330c 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)
516 /*Get extension of file*/ 516 /*Get extension of file*/
517 tmp = strdup(event_info); 517 tmp = strdup(event_info);
518 a = strrchr(tmp,'.'); 518 a = strrchr(tmp,'.');
519 if (!a)
520 {
521 free(tmp);
522 return;
523 }
519 format = malloc(sizeof (char) * (strlen(a) - 1)); 524 format = malloc(sizeof (char) * (strlen(a) - 1));
520 for (i = 0; i <= (int)strlen(a) - 1; i++) 525 for (i = 0; i <= (int)strlen(a) - 1; i++)
521 format[i] = a[i + 1]; 526 format[i] = a[i + 1];
diff --git a/src/lib/ecore/efl_loop_handler.c b/src/lib/ecore/efl_loop_handler.c
index 3bed513..4c1034e 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)
113 113
114 if (pd->handler_fd) 114 if (pd->handler_fd)
115 _handler_active_update(obj, pd); 115 _handler_active_update(obj, pd);
116 else 116 else if (pd->loop_data)
117 { 117 {
118 pd->handler_fd = _ecore_main_fd_handler_add 118 pd->handler_fd = _ecore_main_fd_handler_add
119 (pd->loop, pd->loop_data, obj, pd->fd, _handler_flags_get(pd), 119 (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)
122 if (pd->handler_fd) _handler_active_update(obj, pd); 122 if (pd->handler_fd) _handler_active_update(obj, pd);
123 } 123 }
124 } 124 }
125 else if (pd->win32) 125 else if (pd->win32 && pd->loop_data)
126 { 126 {
127 pd->handler_win32 = _ecore_main_win32_handler_add 127 pd->handler_win32 = _ecore_main_win32_handler_add
128 (pd->loop, pd->loop_data, obj, pd->win32, _cb_handler_win32, obj); 128 (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 20b5804..02c7e8d 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
274 faces = body->soft_body->m_faces; 274 faces = body->soft_body->m_faces;
275 275
276 slice->index = index; 276 slice->index = index;
277 if (!faces.size()) return slice;
277 slice->p[0].x = _ephysics_body_soft_body_slice_calc( 278 slice->p[0].x = _ephysics_body_soft_body_slice_calc(
278 faces[slice->index].m_n[0]->m_x.x(), delta, max); 279 faces[slice->index].m_n[0]->m_x.x(), delta, max);
279 slice->p[0].y = 1 - _ephysics_body_soft_body_slice_calc( 280 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 dba9ab1..b9011c7 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,
70 val = data; 70 val = data;
71 if (!val) 71 if (!val)
72 *res = 1; 72 *res = 1;
73 73 else if (*val != 7)
74 if (*val != 7)
75 *res = 1; 74 *res = 1;
76 75
77 return EINA_TRUE; 76 return EINA_TRUE;
diff --git a/src/tests/eina/eina_test_matrixsparse.c b/src/tests/eina/eina_test_matrixsparse.c
index c1aba54..5c8b548 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)
208 fail_if(test1 != NULL); 208 fail_if(test1 != NULL);
209 209
210 test1 = eina_matrixsparse_data_idx_get(matrix, 5, 3); 210 test1 = eina_matrixsparse_data_idx_get(matrix, 5, 3);
211 fail_if(!test1);
211 fail_if(*test1 != data[5][3]); 212 fail_if(*test1 != data[5][3]);
212 213
213 r = eina_matrixsparse_column_idx_clear(matrix, 3); 214 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 d5777ed..95138e2 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)
92 Eina_List *l; 92 Eina_List *l;
93 Evas_Canvas3D_Mesh_Frame *f; 93 Evas_Canvas3D_Mesh_Frame *f;
94 94
95 if (!pd) return NULL;
95 EINA_LIST_FOREACH(pd->frames, l, f) 96 EINA_LIST_FOREACH(pd->frames, l, f)
96 { 97 {
97 if (f->frame == 0) 98 if (f->frame == 0)