Fix various potential illegal access and memory leaks in error conditions.

This commit is contained in:
Justin Maggard
2014-04-07 11:20:19 -07:00
parent 6e43ab3c06
commit d492b43ef8
10 changed files with 34 additions and 21 deletions

View File

@ -41,11 +41,9 @@
static int
art_cache_exists(const char *orig_path, char **cache_file)
{
if( asprintf(cache_file, "%s/art_cache%s", db_path, orig_path) < 0 )
{
*cache_file = NULL;
if( xasprintf(cache_file, "%s/art_cache%s", db_path, orig_path) < 0 )
return 0;
}
strcpy(strchr(*cache_file, '\0')-4, ".jpg");
return (!access(*cache_file, F_OK));