[Tux4kids-commits] r82 - tuxtype/trunk/tuxtype
calarndt at alioth.debian.org
calarndt at alioth.debian.org
Thu Mar 8 21:34:49 CET 2007
Author: calarndt
Date: 2006-01-31 02:44:31 +0000 (Tue, 31 Jan 2006)
New Revision: 82
Modified:
tuxtype/trunk/tuxtype/scripting.c
Log:
close more memory leaks.
Modified: tuxtype/trunk/tuxtype/scripting.c
===================================================================
--- tuxtype/trunk/tuxtype/scripting.c 2006-01-30 16:35:35 UTC (rev 81)
+++ tuxtype/trunk/tuxtype/scripting.c 2006-01-31 02:44:31 UTC (rev 82)
@@ -768,7 +768,7 @@
/* create a list of all the .txt files */
wordsDir = opendir( wordPath );
-
+ font = LoadFont( ttf_font, 14 );
do {
wordsFile = readdir(wordsDir);
if (!wordsFile)
@@ -782,9 +782,10 @@
continue;
sprintf( wordlistFile[c], "%s", wordsFile->d_name );
- font = LoadFont( ttf_font, 14 );
+
filenames[c] = TTF_RenderText_Blended( font, wordsFile->d_name, white);
SDL_BlitSurface( filenames[c], NULL, screen, &spot );
+ SDL_FreeSurface(filenames[c]);
c++;
spot.y+=18;
@@ -799,10 +800,10 @@
lists++;
fclose(tempFile);*/
- TTF_CloseFont(font);
} while (1);
+ TTF_CloseFont(font);
closedir( wordsDir );
SDL_Flip( screen );
@@ -892,7 +893,14 @@
}
}
- if (old_loc != loc) {
+ if (stop == 2) {
+ SDL_FreeSurface(pointer);
+ SDL_FreeSurface(left);
+ SDL_FreeSurface(right);
+ SDL_FreeSurface(bkg);
+ return;
+ }
+ if (old_loc != loc) {
int start;
SDL_BlitSurface( bkg, &arrow_area, screen, NULL);
@@ -912,6 +920,9 @@
}
SDL_FreeSurface(pointer);
+ SDL_FreeSurface(left);
+ SDL_FreeSurface(right);
+ SDL_FreeSurface(bkg);
if (loadScript( fn ) != 0) return; // bail if any errors occur
runScript();
More information about the Tux4kids-commits
mailing list