magic/commands
Darryl L. Miles e88dcba1c5 CodeQL File{MayNot,Never}BeClosed.ql file-handle resource leaks
Guided by CodeQL static code analyser.

FileMayNotBeClosed.ql
FileMayNeverBeClosed.ql

The trick with "if(fp != stdout)" is problematic (to analyser) as
technically 'stdout' can be a global pointer that COULD be modified any
time, so it might have changed between the fopen() and fclose() calls so
the close MAY NEVER occurs (which is problem the analyzer can see).

So local state is maintained as a bool which will also clarify to the
compiler see the intention without concern for external stdout
modification.

Some items appear to be out and out leaks when certain commands are use.
2025-02-22 21:02:49 -05:00
..
CmdAB.c gcc11 -Wall -Wpedantic cleanup (post __attribute__ DLONG_PREFIX) 2025-01-06 16:27:10 +00:00
CmdAuto.c K&R commands/*.c: bulk function implementation conversion 2024-12-26 13:13:13 -05:00
CmdCD.c CodeQL File{MayNot,Never}BeClosed.ql file-handle resource leaks 2025-02-22 21:02:49 -05:00
CmdE.c gcc11 -Wall -Wpedantic cleanup 2025-01-06 16:12:11 +00:00
CmdFI.c feat: flush [-noprompt], option support 2025-01-07 13:58:45 -05:00
CmdLQ.c command: use 'const' with readonly data 2025-01-04 11:31:17 -05:00
CmdRS.c command: use 'const' with 'rcsid' 2025-01-04 11:31:17 -05:00
CmdSubrs.c command: use 'const' with readonly data 2025-01-04 11:31:17 -05:00
CmdTZ.c CodeQL File{MayNot,Never}BeClosed.ql file-handle resource leaks 2025-02-22 21:02:49 -05:00
CmdWizard.c command: use 'const' with 'rcsid' 2025-01-04 11:31:17 -05:00
Makefile Initial commit at Tue Apr 25 08:41:48 EDT 2017 by tim on stravinsky 2017-04-25 08:41:48 -04:00
commands.h commands.h: add #include "textio/txcommands.h" 2024-12-26 13:13:13 -05:00