From: Joseph Sutton Date: Thu, 27 Apr 2023 03:15:03 +0000 (+1200) Subject: s4/scripting/bin: Fix resource leak X-Git-Tag: talloc-2.4.1~747 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2727e33dbdb6b4f8464d93ca6358fcbb0180ab31;p=thirdparty%2Fsamba.git s4/scripting/bin: Fix resource leak Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett --- diff --git a/source4/scripting/bin/gen_ntstatus.py b/source4/scripting/bin/gen_ntstatus.py index b4a9bfc1586..9b04165ed81 100755 --- a/source4/scripting/bin/gen_ntstatus.py +++ b/source4/scripting/bin/gen_ntstatus.py @@ -126,9 +126,8 @@ def main (): sys.exit() # read in the data - file_contents = io.open(input_file, "rt", encoding='utf8') - - errors = parseErrorDescriptions(file_contents, False, transformErrorName) + with io.open(input_file, "rt", encoding='utf8') as file_contents: + errors = parseErrorDescriptions(file_contents, False, transformErrorName) print("writing new header file: %s" % gen_headerfile_name) out_file = io.open(gen_headerfile_name, "wt", encoding='utf8')