Fix asset animation free on load fail

This commit is contained in:
Willy-JL
2023-02-12 23:24:18 +00:00
parent 8a2434c978
commit 2f4adec619
+11 -1
View File
@@ -38,7 +38,17 @@ void anim(const Icon** replace, const char* name, FuriString* path, File* file)
if(storage_file_read(file, (void*)icon->frames[i], size) == size) ok = true;
storage_file_close(file);
}
if(!ok) break;
if(!ok) {
for(int i = 0; i < icon->frame_count; ++i) {
if(icon->frames[i]) {
free((void*)icon->frames[i]);
}
}
free((void*)icon->frames);
free(icon);
break;
}
*replace = icon;
} while(false);