evas/cserve2: fix error parameter usage

The error pointer could be NULL but still dereferenced in case of
failure. Also, it wasn't reset in case of success.
This commit is contained in:
Jean-Philippe Andre 2013-07-04 15:13:20 +09:00
parent bb30cd58ce
commit 8b257d0238
1 changed files with 7 additions and 1 deletions

View File

@ -235,7 +235,8 @@ _evas_cache_image_entry_new(Evas_Cache2 *cache,
im = calloc(1, sizeof(RGBA_Image));
if (!im)
{
*error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
if (error)
*error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
return NULL;
}
@ -264,12 +265,17 @@ _evas_cache_image_entry_new(Evas_Cache2 *cache,
ERR("couldn't load '%s' '%s' with cserve2!",
ie->file, ie->key ? ie->key : "");
_evas_cache_image_entry_delete(cache, ie);
if (error)
*error = EVAS_LOAD_ERROR_GENERIC;
return NULL;
}
}
if (ie->cache_key) _evas_cache_image_activ_add(ie);
else _evas_cache_image_dirty_add(ie);
if (error)
*error = EVAS_LOAD_ERROR_NONE;
return ie;
}