edje_edit: Check return value of eet_list() to avoid NULL dereference.

We check eet_list elsewhere and it might retrun NULL. Don't just hope
keys will never be NULL. Check it.

CID 1232733
This commit is contained in:
Stefan Schmidt 2014-09-04 14:18:58 +02:00
parent 0d9f0d8ffb
commit 703d179eb6
1 changed files with 11 additions and 8 deletions

View File

@ -210,18 +210,21 @@ _edje_edit_efl_file_file_set(Eo *obj, Edje_Edit *eed, const char *file, const ch
snprintf(buf, sizeof(buf), "edje/scripts/embryo/source/%i/*",
eed->base->collection->id);
keys = eet_list(ef, buf, &count);
for (i = 0; i < count; i++)
if (keys)
{
Program_Script *ps;
int size;
for (i = 0; i < count; i++)
{
Program_Script *ps;
int size;
ps = calloc(1, sizeof(Program_Script));
ps = calloc(1, sizeof(Program_Script));
sscanf(keys[i] + len, "%*i/%i", &ps->id);
ps->code = eet_read(ef, keys[i], &size);
eina_hash_add(eed->program_scripts, &ps->id, ps);
sscanf(keys[i] + len, "%*i/%i", &ps->id);
ps->code = eet_read(ef, keys[i], &size);
eina_hash_add(eed->program_scripts, &ps->id, ps);
}
free(keys);
}
if (keys) free(keys);
eet_close(ef);
ret = EINA_TRUE;