From: <Mee...@us...> - 2011-12-21 18:03:51
|
Revision: 3709 http://sc2.svn.sourceforge.net/sc2/?rev=3709&view=rev Author: Meep-Eep Date: 2011-12-21 18:03:45 +0000 (Wed, 21 Dec 2011) Log Message: ----------- Fix memory leak, from louisdx. Modified Paths: -------------- trunk/sc2/ChangeLog trunk/sc2/src/libs/file/dirs.c Modified: trunk/sc2/ChangeLog =================================================================== --- trunk/sc2/ChangeLog 2011-12-21 17:59:49 UTC (rev 3708) +++ trunk/sc2/ChangeLog 2011-12-21 18:03:45 UTC (rev 3709) @@ -1,4 +1,5 @@ Changes towards version 0.8: +- Fix memory leak in mkdirhier(), from Loius Delacroix - Some cleanups / warnings fixes, from Louis Delacroix - Added a free callback function for the values of the key-value pairs in hash tables - SvdB Modified: trunk/sc2/src/libs/file/dirs.c =================================================================== --- trunk/sc2/src/libs/file/dirs.c 2011-12-21 17:59:49 UTC (rev 3708) +++ trunk/sc2/src/libs/file/dirs.c 2011-12-21 18:03:45 UTC (rev 3709) @@ -142,7 +142,7 @@ if (*pathstart == '\0') { // path exists completely, nothing more to do - return 0; + goto success; } // walk through the path as long as the components exist @@ -177,7 +177,7 @@ } if (*pathend == '\0') - return 0; + goto success; *ptr = '/'; ptr++; @@ -187,7 +187,7 @@ // pathstart is the next non-slash character if (*pathstart == '\0') - return 0; + goto success; } // create all components left @@ -221,6 +221,9 @@ ptr += pathend - pathstart; *ptr = '\0'; } + +success: + HFree (buf); return 0; err: @@ -641,6 +644,7 @@ *destptr = '\0'; } + HFree (buf); return 0; err: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |