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
This commit is contained in:
Mike Blumenkrantz 2019-10-18 13:30:10 -04:00
parent c12008b4d0
commit 20b592cef7
9 changed files with 18 additions and 7 deletions

View File

@ -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));

View File

@ -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);

View File

@ -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];

View File

@ -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];

View File

@ -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);

View File

@ -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(

View File

@ -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;

View File

@ -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);

View File

@ -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)