From 7bcf2276a751461c5aaf07cef28fbb60bfbca56c Mon Sep 17 00:00:00 2001 From: Adubbz Date: Tue, 6 Aug 2019 19:16:27 +1000 Subject: [PATCH] Added a scope guard for WritePlaceHolder --- stratosphere/ncm/source/ncm_contentstorage.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stratosphere/ncm/source/ncm_contentstorage.cpp b/stratosphere/ncm/source/ncm_contentstorage.cpp index 0697f9df4..96de686db 100644 --- a/stratosphere/ncm/source/ncm_contentstorage.cpp +++ b/stratosphere/ncm/source/ncm_contentstorage.cpp @@ -155,6 +155,8 @@ namespace sts::ncm { } } R_END_TRY_CATCH; + auto file_guard = SCOPE_GUARD { fclose(f); }; + if (fseek(f, offset, SEEK_SET) != 0) { return fsdevGetLastResult(); } @@ -168,7 +170,7 @@ namespace sts::ncm { } this->placeholder_accessor.StoreToCache(f, placeholder_id); - + file_guard.Cancel(); return ResultSuccess; }