From 656d0c74a736dcf93438dd9187ecfb3e8b02126d Mon Sep 17 00:00:00 2001 From: George Kadianakis Date: Wed, 29 Mar 2023 22:51:50 +0900 Subject: [PATCH] nodejs: Remove the fclose() error handling (#261) --- bindings/node.js/src/kzg.cxx | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/bindings/node.js/src/kzg.cxx b/bindings/node.js/src/kzg.cxx index 57a9cd3..e60770e 100644 --- a/bindings/node.js/src/kzg.cxx +++ b/bindings/node.js/src/kzg.cxx @@ -147,17 +147,10 @@ Napi::Value LoadTrustedSetup(const Napi::CallbackInfo& info) { // Load the trusted setup from that file C_KZG_RET ret = load_trusted_setup_file(&(data->settings), file_handle); - // Close the trusted setup file - if (fclose(file_handle) != 0) { - if (ret == C_KZG_OK) { - free_trusted_setup(&(data->settings)); - } - Napi::Error::New(env, "Error closing trusted setup file").ThrowAsJavaScriptException(); - return env.Undefined(); - } + fclose(file_handle); - // Check that it was successful + // Check that loading the trusted setup was successful if (ret != C_KZG_OK) { Napi::Error::New(env, "Error loading trusted setup file: " + file_path).ThrowAsJavaScriptException(); return env.Undefined();