]> granicus.if.org Git - nethack/commit
plug potential open file leak in checkfile()
authorPatR <rankin@nethack.org>
Tue, 18 Dec 2018 10:44:21 +0000 (02:44 -0800)
committerPatR <rankin@nethack.org>
Tue, 18 Dec 2018 10:44:21 +0000 (02:44 -0800)
commit16e78e5b608077cdaef38f5acff546307da911f6
tree83b382fe8e63854b4ee6c1630f7155160f150411
parent83e35a73bd818032bd606966cf0fdbd9d9463b51
plug potential open file leak in checkfile()

Another item from static analysis.  If an internal error ever caused
the "bad do_look buffer" warning from checkfile(), open file 'data'
would not be closed.  (The bug in checkfile()'s caller which prompted
that check was fixed long go.)

An alternate fix would be to move the input buffer check to before
the file is opened, but verifying the file first seems worthwhile.
src/pager.c