some leaks fixed
authornotaz <notasas@gmail.com>
Sat, 2 Jun 2007 14:31:36 +0000 (14:31 +0000)
committernotaz <notasas@gmail.com>
Sat, 2 Jun 2007 14:31:36 +0000 (14:31 +0000)
git-svn-id: file:///home/notaz/opt/svn/fceu@145 be3aeb3a-fb24-0410-a615-afba39da0efa

drivers/gp2x/menu.c
drivers/gp2x/minimal.c
drivers/gp2x_test/minimal.c
fds.c
general.c
ines.c
unif.c

index 25c886f..cdd06b2 100644 (file)
@@ -1044,7 +1044,7 @@ static int menu_loop_options(void)
 \r
 static void draw_menu_credits(void)\r
 {\r
-       char vstr[16];\r
+       char vstr[32];\r
 \r
        //int tl_x = 15, tl_y = 70;\r
        gp2x_fceu_copy_bg();\r
@@ -1054,7 +1054,7 @@ static void draw_menu_credits(void)
        gp2x_text_out15(20,  40, "(c) notaz, 2007");\r
 \r
        gp2x_text_out15(20,  70, "Based on FCE Ultra versions");\r
-       gp2x_text_out15(20,  80, "0.81 and 0.98.15");\r
+       gp2x_text_out15(20,  80, "0.81 and 0.98.1x");\r
 \r
        gp2x_text_out15(20, 110, "         - Credits - ");\r
        gp2x_text_out15(20, 130, "Bero: FCE");\r
index 1ac5129..e11643e 100644 (file)
@@ -68,7 +68,8 @@ void gp2x_video_flip(void)
 \r
        // since we are using the mmu hack, we must flush the cache first\r
        // (the params are most likely wrong, but they seem to work somehow)\r
-       flushcache(addr, addr + 320*240*2, 0);\r
+       //flushcache(addr, addr + 320*240*2, 0);\r
+       flushcache(gp2x_screen, (char *)gp2x_screen + 320*240*2, 0);\r
 \r
        lsw = (unsigned short) addr;\r
        msw = (unsigned short)(addr >> 16);\r
index a32a08f..793af74 100644 (file)
@@ -235,6 +235,7 @@ void gp2x_deinit(void)
        SDL_QuitSubSystem(SDL_INIT_VIDEO);
        SDL_Quit();
 
+       free(gp2x_screen);
        if (sounddev > 0) close(sounddev);
        gp2x_usbjoy_deinit();
 }
diff --git a/fds.c b/fds.c
index e5307ac..501aefc 100644 (file)
--- a/fds.c
+++ b/fds.c
@@ -917,30 +917,39 @@ void FDSClose(void)
  int x;\r
  char *fn;\r
 \r
- if(!DiskWritten) return;\r
-\r
- fn=FCEU_MakeFName(FCEUMKF_FDS,0,0);\r
-\r
- if(!(fp=FCEUD_UTF8fopen(fn,"wb")))\r
+ if(!DiskWritten)\r
  {\r
-  free(fn);\r
-  return;\r
- }\r
- free(fn);\r
+  fn=FCEU_MakeFName(FCEUMKF_FDS,0,0);\r
 \r
- for(x=0;x<TotalSides;x++)\r
- {\r
-  if(fwrite(diskdata[x],1,65500,fp)!=65500)\r
+  if(!(fp=FCEUD_UTF8fopen(fn,"wb")))\r
   {\r
-   FCEU_PrintError("Error saving FDS image!");\r
-   fclose(fp);\r
+   free(fn);\r
    return;\r
   }\r
- }\r
- FreeFDSMemory();\r
- fclose(fp);\r
+  free(fn);\r
+\r
+  for(x=0;x<TotalSides;x++)\r
+  {\r
+   if(fwrite(diskdata[x],1,65500,fp)!=65500)\r
+   {\r
+    FCEU_PrintError("Error saving FDS image!");\r
+    fclose(fp);\r
+    return;\r
+   }\r
+  }\r
+  fclose(fp);\r
 #ifdef GP2X\r
- sync();\r
 sync();\r
 #endif\r
+ }\r
+\r
+ FreeFDSMemory();\r
+ for(x=0;x<TotalSides;x++)\r
+  if(diskdatao[x])\r
+  {\r
+   free(diskdatao[x]);\r
+   diskdatao[x]=0;\r
+  }\r
+ ResetExState(0,0);\r
 }\r
 \r
index c87fae8..46383c2 100644 (file)
--- a/general.c
+++ b/general.c
@@ -202,13 +202,6 @@ char *FCEU_MakeFName(int type, int id1, char *cd1)
                     asprintf(&ret,"%s"PSS"%s.%s",odirs[FCEUIOD_NV],FileBase,cd1);
                   else
                     asprintf(&ret,"%s"PSS"sav"PSS"%s.%s",BaseDirectory,FileBase,cd1);
-                   if(stat(ret,&tmpstat)==-1)
-                   {
-                    if(odirs[FCEUIOD_NV])
-                     asprintf(&ret,"%s"PSS"%s.%s",odirs[FCEUIOD_NV],FileBase,cd1);
-                    else
-                     asprintf(&ret,"%s"PSS"sav"PSS"%s.%s",BaseDirectory,FileBase,cd1);
-                   }
                    break;
   case FCEUMKF_CHEAT:
                      if(odirs[FCEUIOD_CHEATS])
diff --git a/ines.c b/ines.c
index ad1e926..2f5fbeb 100644 (file)
--- a/ines.c
+++ b/ines.c
@@ -119,6 +119,7 @@ static void iNESGI(int h, void *param)
                 if(VROM) {free(VROM);VROM=0;}\r
                 if(MapClose) MapClose();\r
                 if(trainerpoo) {FCEU_gfree(trainerpoo);trainerpoo=0;}\r
+                ResetExState(0,0);\r
                }\r
                break;\r
   case GI_INFOSTRING:\r
diff --git a/unif.c b/unif.c
index 60928fd..03430f5 100644 (file)
--- a/unif.c
+++ b/unif.c
@@ -516,6 +516,7 @@ static void UNIFGI(int h, void *param)
                if(UNIFCart.Close)\r
                 UNIFCart.Close();\r
                 FreeUNIF();\r
+               ResetExState(0,0);\r
                 break;\r
   case GI_INFOSTRING:\r
                {\r