From: <los...@us...> - 2008-05-30 17:32:42
|
Revision: 595 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=595&view=rev Author: lostgeneration Date: 2008-05-30 10:32:39 -0700 (Fri, 30 May 2008) Log Message: ----------- Moved check for free(NULL) up in code to avoid potential problems. * It seems that calling free(NULL) was causing problems. Moving the check for NULL up seems to help. Modified Paths: -------------- kos/doc/CHANGELOG kos/kernel/libc/koslib/malloc.c Modified: kos/doc/CHANGELOG =================================================================== --- kos/doc/CHANGELOG 2008-05-28 13:43:26 UTC (rev 594) +++ kos/doc/CHANGELOG 2008-05-30 17:32:39 UTC (rev 595) @@ -154,6 +154,7 @@ - *** Added support for upgrading a read lock on a reader/writer semaphore to a write lock [LS] - *** Added a recursive lock synchronization primitive [LS] +- *** Moved checking for free(NULL) up in code to avoid potential problems [HL] KallistiOS version 1.2.0 ----------------------------------------------- - DC Fix to use DCARM7_CFLAGS when compiling ARM driver [Christian Groessler == CG] Modified: kos/kernel/libc/koslib/malloc.c =================================================================== --- kos/kernel/libc/koslib/malloc.c 2008-05-28 13:43:26 UTC (rev 594) +++ kos/kernel/libc/koslib/malloc.c 2008-05-30 17:32:39 UTC (rev 595) @@ -1733,6 +1733,10 @@ int dmg = 0; #endif + /* standard C says if block is NULL, do not try to free it */ + if(m == NULL) + return; + if (MALLOC_PREACTION != 0) { return; } @@ -1744,9 +1748,6 @@ thd_current->tid, rv, (uint32)m); #endif - if (m == NULL) - return; - ctl = get_memctl(m); if (ctl->magic != BLOCK_MAGIC) { #ifndef KM_DBG_VERBOSE This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |