Ephoto: Fix coverity issues: CID 151524, 151521, 151520, 151518, 151517, 151516, 151515, 151512
This commit is contained in:
parent
edd58aa3a6
commit
621fb3be0b
|
@ -1170,13 +1170,10 @@ ephoto_directory_browser_initialize_structure(Ephoto *ephoto)
|
|||
memset(path, 0x00, sizeof(path));
|
||||
snprintf(path, PATH_MAX, "%s", dir);
|
||||
}
|
||||
if (dir)
|
||||
{
|
||||
free(dir);
|
||||
dir = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
EINA_LIST_FOREACH(dirs, l, dir)
|
||||
{
|
||||
Eina_Iterator *it;
|
||||
|
@ -1224,7 +1221,6 @@ ephoto_directory_browser_initialize_structure(Ephoto *ephoto)
|
|||
{
|
||||
_monitor_add(entry);
|
||||
entry->genlist = db->fsel;
|
||||
}
|
||||
if (n)
|
||||
{
|
||||
if (!strcmp(n, entry->path))
|
||||
|
@ -1236,6 +1232,7 @@ ephoto_directory_browser_initialize_structure(Ephoto *ephoto)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
count++;
|
||||
free(dir);
|
||||
}
|
||||
|
@ -1253,6 +1250,7 @@ ephoto_directory_browser_initialize_structure(Ephoto *ephoto)
|
|||
}
|
||||
ephoto_title_set(ephoto, ephoto->config->directory);
|
||||
db->initializing = EINA_FALSE;
|
||||
free(end_dir);
|
||||
}
|
||||
|
||||
Evas_Object *
|
||||
|
|
|
@ -744,7 +744,8 @@ _delete_thread_cb(void *data, Ecore_Thread *et EINA_UNUSED)
|
|||
int ret;
|
||||
struct stat s;
|
||||
|
||||
lstat(file, &s);
|
||||
if (lstat(file, &s))
|
||||
{
|
||||
if (S_ISLNK(s.st_mode))
|
||||
{
|
||||
ret = ecore_file_unlink(file);
|
||||
|
@ -778,6 +779,7 @@ _delete_thread_cb(void *data, Ecore_Thread *et EINA_UNUSED)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_delete_files(Ephoto *ephoto, Eina_List *files)
|
||||
|
@ -919,11 +921,21 @@ _prompt_upload_apply(void *data, Evas_Object *obj EINA_UNUSED,
|
|||
evas_object_show(popup);
|
||||
|
||||
f = fopen(entry->path, "rb");
|
||||
if (!f) CRIT("unable to open '%s': %s", entry->path, strerror(errno));
|
||||
if (!f)
|
||||
{
|
||||
CRIT("unable to open '%s': %s", entry->path, strerror(errno));
|
||||
evas_object_del(popup);
|
||||
return;
|
||||
}
|
||||
res = fseek(f, 0, SEEK_END);
|
||||
if (!res) CRIT("fseek() failed on file '%s': %s", entry->path, strerror(errno));
|
||||
fsize = ftell(f);
|
||||
if (fsize == -1) CRIT("ftell() failed on file '%s': %s", entry->path, strerror(errno));
|
||||
if (fsize == -1)
|
||||
{
|
||||
CRIT("ftell() failed on file '%s': %s", entry->path, strerror(errno));
|
||||
evas_object_del(popup);
|
||||
return;
|
||||
}
|
||||
rewind(f);
|
||||
fdata = malloc(fsize);
|
||||
res = fread(fdata, fsize, 1, f);
|
||||
|
@ -1007,15 +1019,21 @@ _prompt_save_image_as_apply(void *data, Evas_Object *obj, void *event_info)
|
|||
else
|
||||
{
|
||||
ext = eina_stringshare_add((strrchr(selected, '.')+1));
|
||||
if (ext)
|
||||
{
|
||||
if (!_ephoto_file_image_can_save(ext))
|
||||
{
|
||||
if (ext)
|
||||
eina_stringshare_del(ext);
|
||||
snprintf(buf, PATH_MAX, "%s.jpg", selected);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ext)
|
||||
eina_stringshare_del(ext);
|
||||
snprintf(buf, PATH_MAX, "%s", selected);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
eina_stringshare_del(ext);
|
||||
snprintf(buf, PATH_MAX, "%s", selected);
|
||||
}
|
||||
|
|
|
@ -995,7 +995,10 @@ ephoto_directory_set(Ephoto *ephoto, const char *path, Evas_Object *expanded,
|
|||
ed->thumbs_only = thumbs_only;
|
||||
|
||||
if (!ecore_file_can_read(path))
|
||||
{
|
||||
free(ed);
|
||||
return;
|
||||
}
|
||||
|
||||
EINA_LIST_FREE(ed->ephoto->thumbs, o)
|
||||
evas_object_del(o);
|
||||
|
|
Loading…
Reference in New Issue