Previous 15994 Revisions Next

r7821 Thursday 15th April, 2010 at 23:17:50 UTC by Firewave
[WINUI/MESSUI] Fixed memory leaks
[src/mess/osd/winui]messui.c softwarepicker.c
[src/osd/winui]winui.c

src/osd/winui/winui.c
r7820r7821
55775577   if (utf8_filename != NULL)
55785578   {
55795579      snprintf(filename, MAX_PATH, "%s", utf8_filename);
5580      global_free(utf8_filename);
55805581   }
55815582
55825583   return success;
src/mess/osd/winui/messui.c
r7820r7821
906906      /* We only want the first path; throw out the rest */
907907      i = astring_chr(&as, 0, ';');
908908      if (i > 0) astring_substr(&as, 0, i);
909      global_free(s);
909910      s = tstring_from_utf8(astring_c(&as));
910911
911912      /* Make sure a folder was specified in the tab, and that it exists */
r7820r7821
917918         /* We only want the first path; throw out the rest */
918919         i = astring_chr(&as, 0, ';');
919920         if (i > 0) astring_substr(&as, 0, i);
921         global_free(s);
920922         s = tstring_from_utf8(astring_c(&as));
921923
922924         /* Make sure a folder was specified in the tab, and that it exists */
r7820r7821
926928
927929            osd_get_full_path(&dst,".");
928930            /* Default to emu directory */
931            global_free(s);
929932            s = tstring_from_utf8(dst);
930933
931934            /* If software folder exists, use it instead */
932935            zippath_combine(&as, dst, "software");
933            if (osd_opendir(astring_c(&as))) s = tstring_from_utf8(astring_c(&as));
936            if (osd_opendir(astring_c(&as)))
937            {
938               global_free(s);
939               s = tstring_from_utf8(astring_c(&as));
940            }
934941            global_free(dst);
935942         }
936943      }
r7820r7821
939946   SetupImageTypes(config, imagetypes, ARRAY_LENGTH(imagetypes), TRUE, dev);
940947   bResult = CommonFileImageDialog(s, GetOpenFileName, pszFilename, config, imagetypes);
941948   
942   /* TODO: free() calls? */
949   global_free(s);
943950
944951   return bResult;
945952}
r7820r7821
981988      /* We only want the first path; throw out the rest */
982989      i = astring_chr(&as, 0, ';');
983990      if (i > 0) astring_substr(&as, 0, i);
991      global_free(s);
984992      s = tstring_from_utf8(astring_c(&as));
985993
986994      /* Make sure a folder was specified in the tab, and that it exists */
r7820r7821
990998
991999         osd_get_full_path(&dst,".");
9921000         /* Default to emu directory */
1001         global_free(s);
9931002         s = tstring_from_utf8(dst);
9941003
9951004         /* If software folder exists, use it instead */
9961005         zippath_combine(&as, dst, "software");
997         if (osd_opendir(astring_c(&as))) s = tstring_from_utf8(astring_c(&as));
1006         if (osd_opendir(astring_c(&as)))
1007         {
1008            global_free(s);
1009            s = tstring_from_utf8(astring_c(&as));
1010         }
9981011         global_free(dst);
9991012      }
10001013   }
r7820r7821
10021015   SetupImageTypes(config, imagetypes, ARRAY_LENGTH(imagetypes), TRUE, dev);
10031016   bResult = CommonFileImageDialog(s, GetSaveFileName, pszFilename, config, imagetypes);
10041017   
1005   /* TODO: free() calls? */
1018   global_free(s);
10061019
10071020   return bResult;
10081021}
src/mess/osd/winui/softwarepicker.c
r7820r7821
631631   else
632632      rc = SoftwarePicker_InternalAddFile(hwndPicker, pszFilename, FALSE);
633633
634      global_free(utf8_FileName);
634   global_free(utf8_FileName);
635635   return rc;
636636}
637637

Previous 15994 Revisions Next


© 1998-2018 The MESS Team