aboutsummaryrefslogtreecommitdiffstats
path: root/vstgui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-02-01 19:24:22 +0000
committerDavid Robillard <d@drobilla.net>2010-02-01 19:24:22 +0000
commit4514036c46168f4bbc693649989d53bdffe6137b (patch)
tree2bc088e58a944066049db727e99be6ea565fafc0 /vstgui
parent0d871f60dcc3ba4d161b58091f7c5405c87afd88 (diff)
downloadmda.lv2-4514036c46168f4bbc693649989d53bdffe6137b.tar.gz
mda.lv2-4514036c46168f4bbc693649989d53bdffe6137b.tar.bz2
mda.lv2-4514036c46168f4bbc693649989d53bdffe6137b.zip
Fix leaks and an iterator error found by cppcheck.
git-svn-id: http://svn.drobilla.net/lad/trunk/mda-lv2@2399 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'vstgui')
-rw-r--r--vstgui/vstgui.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/vstgui/vstgui.cpp b/vstgui/vstgui.cpp
index bf80a82..fe2ef55 100644
--- a/vstgui/vstgui.cpp
+++ b/vstgui/vstgui.cpp
@@ -3755,21 +3755,24 @@ bool CBitmap::openPng (const char* path)
fread(header, 1, 8, fp);
if (png_sig_cmp(header, 0, 8)) {
fprintf(stderr, "File not recognized as a PNG image");
+ fclose(fp);
return false;
}
pngRead = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
- if (!pngRead) {
+ if (!pngRead) {
fprintf(stderr, "Unable to initialize libpng\n");
+ fclose(fp);
return false;
}
pngInfo = png_create_info_struct(pngRead);
- if (!pngInfo) {
- png_destroy_read_struct(&pngRead, NULL, NULL);
+ if (!pngInfo) {
+ png_destroy_read_struct(&pngRead, NULL, NULL);
pngRead = NULL;
- return false;
- }
+ fclose(fp);
+ return false;
+ }
png_init_io(pngRead, fp);
png_set_sig_bytes(pngRead, 8);