Fix memory leak with Epub object getting orphaned

This commit is contained in:
Dave Allie
2025-12-06 02:49:10 +11:00
parent 7198d943b0
commit 98c8e7e77c
4 changed files with 22 additions and 10 deletions

View File

@@ -51,7 +51,7 @@ Epub* loadEpub(const std::string& path) {
}
Serial.println("Failed to load epub");
free(epub);
delete epub;
return nullptr;
}
@@ -122,6 +122,8 @@ void onSelectEpubFile(const std::string& path) {
} else {
exitScreen();
enterNewScreen(new FullScreenMessageScreen(renderer, "Failed to load epub", REGULAR, false, false));
delay(2000);
onGoHome();
}
}