ethumb: Fix resource leak
authorChris Michael <cp.michael@samsung.com>
Wed, 25 Jan 2017 13:56:38 +0000 (08:56 -0500)
committerChris Michael <cp.michael@samsung.com>
Wed, 25 Jan 2017 14:09:38 +0000 (09:09 -0500)
Coverity reports a resource leak here as we were not freeing
'sanitized_path' inside the if statement.

Fixes CID1367502

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
src/lib/ethumb/ethumb.c

index ef18564..73ec5b9 100644 (file)
@@ -844,7 +844,11 @@ ethumb_file_set(Ethumb *e, const char *path, const char *key)
 
    sanitized_path = eina_file_path_sanitize(path);
    DBG("ethumb=%p, path=%s, key=%s", e, sanitized_path ? sanitized_path : "", key ? key : "");
-   if (sanitized_path && access(sanitized_path, R_OK)) return EINA_FALSE;
+   if (sanitized_path && access(sanitized_path, R_OK))
+     {
+        free(sanitized_path);
+        return EINA_FALSE;
+     }
 
    eina_stringshare_replace(&e->src_hash, NULL);
    eina_stringshare_replace(&e->src_path, sanitized_path);