Closed Protofall closed 4 years ago
Potential errors if the pvr texture pointer isn't initialised to zero and the load_dtex
function errors out before malloc-ing vram for the texture data. (ie. One of the header checks fails). This would mean later we try to free a pointer that points to nothing.
Modified it so all 3 load functions init the texture pointer to zero and if an error happens it will free the memory if it was allocated inside the load_dtex
function.
The function headers can be found in Crayon/include/crayon/*
and the C files in Crayon/code/dreamcast/*
. You can tell which function comes from which file since the naming convention is "crayon_filename" so you only need to look in memory
and misc
Note: crayon_assist_change_extension()
and crayon_assist_append_extension()
have had the assist
part of their name changed to misc
and hence they are in misc.c/h
instead and crayon_assist_append_extension
is now known as crayon_misc_combine_strings
Aside from other things discussed offline, I ran cppcheck 1.82 on the root of the project using cppcheck --quiet --enable=warning .
This was the output I found
cppcheck-warnings-errors.txt
All errors (Aside from va_end()
which I'm working on) have been fixed and the warnings are acceptable. Going to close this issue now.
I want to confirm the spritesheet and font loader functions (And the functions they call) aren't showing any memory leaks. Functions to check are:
crayon_memory_load_spritesheet()
crayon_memory_load_dtex()
crayon_assist_append_extension()
crayon_memory_load_palette()
crayon_assist_change_extension()
crayon_memory_load_prop_font_sheet()
crayon_memory_load_mono_font_sheet()