jpeg pushed a commit to branch master.

commit 8b257d02381f0fd5479353a339dc53f1a3887831
Author: Jean-Philippe Andre <[email protected]>
Date:   Thu Jul 4 15:13:20 2013 +0900

    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.
---
 src/lib/evas/cache2/evas_cache2.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/lib/evas/cache2/evas_cache2.c 
b/src/lib/evas/cache2/evas_cache2.c
index fef11d2..81fd78c 100644
--- a/src/lib/evas/cache2/evas_cache2.c
+++ b/src/lib/evas/cache2/evas_cache2.c
@@ -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;
 }
 

-- 

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev

Reply via email to