raduprv / Eternal-Lands

http://www.eternal-lands.com
Other
157 stars 57 forks source link

Fix valgrind alert about lost block by freeing el_gl_window related stuff properly #117

Closed brunoramoslu closed 3 years ago

brunoramoslu commented 3 years ago

Fix valgrind alert about lost block by freeing el_gl_window related stuff properly

==67234== 2,376 (96 direct, 2,280 indirect) bytes in 1 blocks are definitely lost in loss record 174 of 186
==67234==    at 0x483AB65: calloc (vg_replace_malloc.c:760)
==67234==    by 0x48ED351: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.14.0)
==67234==    by 0x4926CD0: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.14.0)
==67234==    by 0x491EF73: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.14.0)
==67234==    by 0x17CD9C: load_window_icon (gl_init.c:78)
==67234==    by 0x17CD9C: init_video (gl_init.c:314)
==67234==    by 0x187193: init_stuff (init.c:859)
==67234==    by 0x1A82D8: main (main.c:555)
pjbroad commented 3 years ago

Thanks for spotting this and producing a fix. Could you change the function definition in gl_init.c to include the void parameter list, also the { probably belongs on the next line to be consistent.

brunoramoslu commented 3 years ago

Thanks for the comments. Force of habit kicked in when I wrote that code. :slightly_smiling_face: It should be fixed now.

pjbroad commented 3 years ago

Thanks.