Fix possible memory leak in error conditions when saving resized album art.

This commit is contained in:
Justin Maggard committed 2014-01-16 16:07:53 -08:00
1 parent a21bbe557d
commit 9eec5b8cac
3 files changed
+15 -16

No files matched your search

+8 -9
View File
@@ -78,18 +78,17 @@ save_resized_album_art(image_s *imsrc, const char *path)
dstw = (imsrc->width<<8) / ((imsrc->height<<8)/160);
dsth = 160;
}
imdst = image_resize(imsrc, dstw, dsth);
imdst = image_resize(imsrc, dstw, dsth);
if( !imdst )
goto error;
if( image_save_to_jpeg_file(imdst, cache_file) == 0 )
{
image_free(imdst);
return cache_file;
free(cache_file);
return NULL;
}
error:
free(cache_file);
return NULL;
cache_file = image_save_to_jpeg_file(imdst, cache_file);
image_free(imdst);
return cache_file;
}
/* And our main album art functions */