Protofall / Crayon-Game-Framework

My own library for making games on the Dreamcast
BSD 3-Clause "New" or "Revised" License
5 stars 0 forks source link

Crayon: Mem-leak check #227

Closed Protofall closed 4 years ago

Protofall commented 4 years ago

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:

Protofall commented 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.

Protofall commented 4 years ago

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

Namdrib commented 4 years ago

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

Protofall commented 4 years ago

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.