[AD] Patch to fix calls to _AL_FREE(0) in src/config.c (4.3.10)

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Hi all.

Please find attached a small patch to fix a problem my memory tracker picked
up in 4.3.10.  In src/config.c:config_cleanup() it was trying to free
config_argv and argv_buf with _AL_FREE() when they were set to NULL.  I
assume that _AL_FREE() follows the same semantics as free() so this is
therefore illegal.

It's my first patch so I hope I got it right.  :-)

-- 
/-------------------------------------------------------------------\
[Hitman/Code HQ - 6502/z80/68000/604e/80x86/ARM coder - Amiga rulez!]
[VZ-200/VIC-20/MZ-700/c16/c64*10/c128*8/Plus-4/CPC464/CD32/500*2    ]
[600/1000/1200*2/A4000/SNES/N64/Dreamcast/Athlon 1100/AmigaOne      ]
[Assembly Language: The most fun you can have with your clothes on! ]
\-------------------------------------------------------------------/
--- src/config.c	(revision 10970)
+++ src/config.c	(working copy)
@@ -207,11 +207,15 @@
       config_hook = NULL;
    }
 
-   _AL_FREE(config_argv);
-   config_argv = NULL;
+   if (config_argv) {
+      _AL_FREE(config_argv);
+      config_argv = NULL;
+   }
    
-   _AL_FREE(argv_buf);
-   argv_buf = NULL;
+   if (argv_buf) {
+      _AL_FREE(argv_buf);
+      argv_buf = NULL;
+   }
    
    argv_buf_size = 0;
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/