Merge "Fix minui cleanup path on error." am: fa9af7dae6
am: af38cd9330
* commit 'af38cd9330d2ee2c96a807e328beb008cd10d789':
Fix minui cleanup path on error.
diff --git a/minui/resources.cpp b/minui/resources.cpp
index fdbe554..8489d60 100644
--- a/minui/resources.cpp
+++ b/minui/resources.cpp
@@ -283,7 +283,7 @@
goto exit;
}
- surface = reinterpret_cast<GRSurface**>(malloc(*frames * sizeof(GRSurface*)));
+ surface = reinterpret_cast<GRSurface**>(calloc(*frames, sizeof(GRSurface*)));
if (surface == NULL) {
result = -8;
goto exit;
@@ -318,7 +318,7 @@
if (result < 0) {
if (surface) {
for (int i = 0; i < *frames; ++i) {
- if (surface[i]) free(surface[i]);
+ free(surface[i]);
}
free(surface);
}
@@ -421,7 +421,7 @@
png_read_row(png_ptr, row.data(), NULL);
int w = (row[1] << 8) | row[0];
int h = (row[3] << 8) | row[2];
- int len = row[4];
+ __unused int len = row[4];
char* loc = reinterpret_cast<char*>(&row[5]);
if (y+1+h >= height || matches_locale(loc, locale)) {