From 556ae89e099592d881dcd786752f3dde2d0e2687 Mon Sep 17 00:00:00 2001 From: Delisa Mason Date: Fri, 15 Dec 2017 16:25:36 -0800 Subject: [PATCH] Skip flushing buffer in error case If there was a parsing error, the buffer has random stuff in it and shouldn't be flushed to disk Introduced in 9b0d3fb --- Source/KSCrash/Source/KSCrash/Recording/BSG_KSCrashState.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/KSCrash/Source/KSCrash/Recording/BSG_KSCrashState.c b/Source/KSCrash/Source/KSCrash/Recording/BSG_KSCrashState.c index a24ba3b34..9654f54ad 100644 --- a/Source/KSCrash/Source/KSCrash/Recording/BSG_KSCrashState.c +++ b/Source/KSCrash/Source/KSCrash/Recording/BSG_KSCrashState.c @@ -266,11 +266,11 @@ bool bsg_kscrashstate_i_saveState(const BSG_KSCrash_State *const state, goto done; } result = bsg_ksjsonendEncode(&JSONContext); - -done: if (!bsg_ksfuflushWriteBuffer(fd)) { BSG_KSLOG_ERROR("Failed to flush write buffer"); } + +done: close(fd); if (result != BSG_KSJSON_OK) {