First post, by ntfshard
Hello
I found some flaws in the source code; So I made this patch. Could you please review it 😊
Fixes:
you can free/delete/delete[] NULL
strstr returns ptr; checking retval against > 0
some logging for midi oss & alsa
some logging in dos_mscdex.cpp
placed several va_end
new doesn't returns NULL by default (exception will be raised) (driver_fat.cpp, hardware.cpp:483, memory.cpp:562, zmbv_vfw.cpp:255,369)
fields initialization should be same with class definition
removed some useless ',' and ';'
tab/spaces in code align corrected
shell_cmds.cpp:109 strcat with NULL => segfaul
cpu.cpp:592 ternary operator has a lower priority that +
class DEBUG (debug.cpp:2077) strncat can overrun buffer args
debug_disasm.cpp:581 some corner case fixed
cdrom_image.cpp:133 struct as a field of struct initialization
dos_files.cpp:81 we should check length before read
dos_files.cpp:917 using bit AND with logic values can be UB
dos_keyboard_layout.cpp:899 unused variable removed && removed call of 'host_readw'
dos_programs.cpp:78(and some other places) static cast from int to char (warning suppress)
midi.cpp:180 we should call std::erase for std::remove
decoder.h:408 dobule break
'default' case for multiply switches => log msg
various files/memory leaks fixed
________________________________
Sorry for the patch size;
Opensuse; cppcheck; clang-analyzer; g++ with pedantic/style warnings;
Maksim D.
PS The "Patches" forum branch is closed for new posts