From db4ef52d22dcafc3d49445146d175ac6dba99c52 Mon Sep 17 00:00:00 2001 From: jpirnay Date: Fri, 8 May 2026 23:50:27 +0200 Subject: [PATCH] Remove the destination file on post-create failures --- lib/Xtc/Xtc.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Xtc/Xtc.cpp b/lib/Xtc/Xtc.cpp index 09f3c736..5ccf5bf2 100644 --- a/lib/Xtc/Xtc.cpp +++ b/lib/Xtc/Xtc.cpp @@ -345,8 +345,9 @@ bool Xtc::generateThumbBmp(int width, int height) const { return false; } + const std::string thumbPath = getThumbBmpPath(width, height); FsFile thumbBmp; - if (!Storage.openFileForWrite("XTC", getThumbBmpPath(width, height), thumbBmp)) { + if (!Storage.openFileForWrite("XTC", thumbPath, thumbBmp)) { free(pageBuffer); return false; } @@ -360,6 +361,7 @@ bool Xtc::generateThumbBmp(int width, int height) const { if (!rowBuffer) { free(pageBuffer); thumbBmp.close(); + Storage.remove(thumbPath.c_str()); return false; }