Fix coverity issues
This commit is contained in:
parent
dc659a2566
commit
7e894d1e69
|
@ -82,7 +82,7 @@ typedef struct
|
|||
{
|
||||
const char *nickname;
|
||||
void *data;
|
||||
int data_count;
|
||||
unsigned int data_count;
|
||||
int version;
|
||||
} Extension_Snapshot;
|
||||
|
||||
|
@ -269,7 +269,6 @@ _configs_load()
|
|||
if (!name_fn)
|
||||
{
|
||||
printf("Can not find extension_name_get function for %s\n", ext_cfg->lib_path);
|
||||
ext_cfg->name = ext_cfg->lib_path;
|
||||
continue;
|
||||
}
|
||||
ext_cfg->name = name_fn();
|
||||
|
@ -277,7 +276,6 @@ _configs_load()
|
|||
if (!nickname_fn)
|
||||
{
|
||||
printf("Can not find extension_nickname_get function for %s\n", ext_cfg->name);
|
||||
ext_cfg->nickname = ext_cfg->lib_path;
|
||||
continue;
|
||||
}
|
||||
ext_cfg->nickname = nickname_fn();
|
||||
|
@ -589,7 +587,11 @@ _extension_instantiate(Extension_Config *cfg)
|
|||
ext = calloc(1, sizeof(*ext));
|
||||
|
||||
sprintf(path, "%s/clouseau/extensions", efreet_config_home_get());
|
||||
if (!_mkdir(path)) return NULL;
|
||||
if (!_mkdir(path))
|
||||
{
|
||||
free(ext);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ext->path_to_config = eina_stringshare_add(path);
|
||||
ext->ext_cfg = cfg;
|
||||
|
@ -655,7 +657,11 @@ _file_get(const char *filename, char **buffer_out)
|
|||
if (!feof(fp)) printf("fread failed\n");
|
||||
}
|
||||
fclose(fp);
|
||||
if (file_data && buffer_out) *buffer_out = file_data;
|
||||
if (file_data)
|
||||
{
|
||||
if (buffer_out) *buffer_out = file_data;
|
||||
else free(file_data);
|
||||
}
|
||||
return file_size;
|
||||
}
|
||||
|
||||
|
@ -774,14 +780,14 @@ _file_import(void *_data EINA_UNUSED, Evas_Object *fs EINA_UNUSED, void *ev)
|
|||
{
|
||||
const char *filename = ev;
|
||||
FILE *fp = fopen(filename, "r");
|
||||
void *eet_buf;
|
||||
void *eet_buf = NULL;
|
||||
Snapshot *s;
|
||||
int eet_size;
|
||||
unsigned int eet_size;
|
||||
if (!fp) return;
|
||||
_snapshot_eet_load();
|
||||
fread(&eet_size, sizeof(int), 1, fp);
|
||||
if (fread(&eet_size, sizeof(int), 1, fp) != 1) goto end;
|
||||
eet_buf = malloc(eet_size);
|
||||
fread(eet_buf, 1, eet_size, fp);
|
||||
if (fread(eet_buf, 1, eet_size, fp) != eet_size) goto end;
|
||||
s = eet_data_descriptor_decode(_snapshot_edd, eet_buf, eet_size);
|
||||
if (s)
|
||||
{
|
||||
|
@ -790,13 +796,15 @@ _file_import(void *_data EINA_UNUSED, Evas_Object *fs EINA_UNUSED, void *ev)
|
|||
EINA_LIST_FREE(s->ext_snapshots, e_s)
|
||||
{
|
||||
void *data = malloc(e_s->data_count);
|
||||
fread(data, 1, e_s->data_count, fp);
|
||||
Extension_Config *e_cfg = _ext_cfg_find_by_nickname(e_s->nickname);
|
||||
if (e_cfg)
|
||||
if (fread(data, 1, e_s->data_count, fp) == e_s->data_count)
|
||||
{
|
||||
Clouseau_Extension *e = _extension_instantiate(e_cfg);
|
||||
if (e->import_data_cb)
|
||||
e->import_data_cb(e, data, e_s->data_count, e_s->version);
|
||||
Extension_Config *e_cfg = _ext_cfg_find_by_nickname(e_s->nickname);
|
||||
if (e_cfg)
|
||||
{
|
||||
Clouseau_Extension *e = _extension_instantiate(e_cfg);
|
||||
if (e->import_data_cb)
|
||||
e->import_data_cb(e, data, e_s->data_count, e_s->version);
|
||||
}
|
||||
}
|
||||
free(data);
|
||||
free(e_s);
|
||||
|
@ -807,6 +815,8 @@ _file_import(void *_data EINA_UNUSED, Evas_Object *fs EINA_UNUSED, void *ev)
|
|||
}
|
||||
else
|
||||
_extensions_cfgs_inwin_create(eina_stringshare_add(filename));
|
||||
end:
|
||||
if (eet_buf) free(eet_buf);
|
||||
if (fp) fclose(fp);
|
||||
}
|
||||
|
||||
|
|
|
@ -867,6 +867,7 @@ eo_debug_eoids_request_prepare(int *size, ...)
|
|||
STORE(tmp, &kl, sizeof(uint64_t));
|
||||
kl = va_arg(list, uint64_t);
|
||||
}
|
||||
va_end(list);
|
||||
*size = nb_kls * sizeof(uint64_t);
|
||||
return buf;
|
||||
}
|
||||
|
@ -948,6 +949,9 @@ eolian_debug_object_information_decode(char *buffer, unsigned int size)
|
|||
|
||||
while (size > 0)
|
||||
{
|
||||
Eolian_Debug_Function *func;
|
||||
Eolian_Function_Parameter *eo_param;
|
||||
Eina_Iterator *itr;
|
||||
int len = strlen(buffer) + 1;
|
||||
if (len > 1) // if class_name is not NULL, we begin a new class
|
||||
{
|
||||
|
@ -957,8 +961,9 @@ eolian_debug_object_information_decode(char *buffer, unsigned int size)
|
|||
}
|
||||
buffer += len;
|
||||
size -= len;
|
||||
if (!kl) goto error;
|
||||
|
||||
Eolian_Debug_Function *func = calloc(1, sizeof(*func));
|
||||
func = calloc(1, sizeof(*func));
|
||||
printf("Class name = %s function = %s\n", eolian_class_name_get(kl->ekl), buffer);
|
||||
kl->functions = eina_list_append(kl->functions, func);
|
||||
func->efunc = eolian_class_function_get_by_name(kl->ekl, buffer, EOLIAN_PROP_GET);
|
||||
|
@ -972,8 +977,7 @@ eolian_debug_object_information_decode(char *buffer, unsigned int size)
|
|||
size -= len;
|
||||
|
||||
//go over function params using eolian
|
||||
Eolian_Function_Parameter *eo_param;
|
||||
Eina_Iterator *itr = eolian_property_values_get(func->efunc, EOLIAN_PROP_GET);
|
||||
itr = eolian_property_values_get(func->efunc, EOLIAN_PROP_GET);
|
||||
EINA_ITERATOR_FOREACH(itr, eo_param)
|
||||
{
|
||||
Eolian_Debug_Basic_Type type = _eolian_type_resolve(
|
||||
|
|
|
@ -70,7 +70,6 @@ typedef struct
|
|||
Eina_Hash *classes_hash_by_name;
|
||||
Eina_Hash *objs_hash;
|
||||
Eina_List *objs_list_tree;
|
||||
Eina_List *screenshots;
|
||||
Eina_Debug_Dispatch_Cb old_disp_cb;
|
||||
} Instance;
|
||||
|
||||
|
@ -252,8 +251,9 @@ _disp_cb(Eina_Debug_Session *session, void *buffer)
|
|||
else if (hdr->opcode == _obj_info_op) sb = &(s->obj_infos_buf);
|
||||
else if (hdr->opcode == _win_screenshot_op) sb = &(s->screenshots_buf);
|
||||
if (sb) _snapshot_buffer_append(sb, buffer);
|
||||
return inst->old_disp_cb(session, buffer);
|
||||
}
|
||||
return inst->old_disp_cb(session, buffer);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -552,7 +552,11 @@ _obj_info_get(Eina_Debug_Session *session, int src, void *buffer, int size)
|
|||
Eolian_Debug_Object_Information *e_info =
|
||||
eolian_debug_object_information_decode(buffer, size);
|
||||
Obj_Info *o_info = eina_hash_find(inst->objs_hash, &(e_info->obj));
|
||||
if (!o_info) return EINA_TRUE;
|
||||
if (!o_info)
|
||||
{
|
||||
eolian_debug_object_information_free(e_info);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
if (o_info->eolian_info)
|
||||
eolian_debug_object_information_free(o_info->eolian_info);
|
||||
|
@ -656,9 +660,13 @@ _win_screenshot_get(Eina_Debug_Session *session EINA_UNUSED, int src EINA_UNUSED
|
|||
Evas_Debug_Screenshot *s = evas_debug_screenshot_decode(buffer, size);
|
||||
if (!s) return EINA_FALSE;
|
||||
Obj_Info *info = eina_hash_find(inst->objs_hash, &(s->obj));
|
||||
if (!info) return EINA_TRUE;
|
||||
if (!info)
|
||||
{
|
||||
free(s->img);
|
||||
free(s);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
info->screenshots = eina_list_append(info->screenshots, s);
|
||||
inst->screenshots = eina_list_append(inst->screenshots, s);
|
||||
if (info->glitem) elm_genlist_item_update(info->glitem);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue