Previous 15994 Revisions Next

r7092 Thursday 21st January, 2010 at 05:30:15 UTC by Miodrag Milanović
Fix some of "attempt to free untracked memory" errors. so newui works fine, no more crashing of tools and loading of images works too.
[src/mess]zippath.c
[src/mess/osd/windows]dialog.c menu.c winmess.c

src/mess/osd/windows/dialog.c
r7091r7092
450450   w_str = str ? wstring_from_utf8(str) : NULL;
451451   rc = dialog_write_string(di, w_str);
452452   if (w_str)
453      free(w_str);
453      global_free(w_str);
454454   if (rc)
455455      return 1;
456456
r7091r7092
678678
679679   w_title = wstring_from_utf8(title);
680680   rc = dialog_write_string(di, w_title);
681   free(w_title);
681   global_free(w_title);
682682   if (rc)
683683      goto error;
684684
r7091r7092
825825      if( !tmp )
826826         return 1;
827827      t_item_label = win_dialog_tcsdup(dialog, tmp);
828      free(tmp);
828      global_free(tmp);
829829      if (!t_item_label)
830830         return 1;
831831   }
r7091r7092
15791579   if (dialog->handle)
15801580      GlobalFree(dialog->handle);
15811581   pool_free_lib(dialog->mempool);
1582   free(dialog);
1582   global_free(dialog);
15831583}
15841584
15851585
src/mess/osd/windows/menu.c
r7091r7092
619619      mameproc(machine, state_filename);
620620   }
621621   if (dir)
622      free(dir);
622      global_free(dir);
623623}
624624
625625
r7091r7092
708708            has_option ? guide : NULL,
709709            has_option ? optspec : NULL);
710710      }
711      free(buf1);
711      global_free(buf1);
712712   }
713713}
714714
r7091r7092
10841084      {
10851085         if (!get_menu_item_string(menu, ++i, TRUE, &sub_menu, buf, ARRAY_LENGTH(buf)))
10861086         {
1087            free(t_menutext);
1087            global_free(t_menutext);
10881088            return NULL;
10891089         }
10901090      }
10911091      while(_tcscmp(t_menutext, buf));
10921092
1093      free(t_menutext);
1093      global_free(t_menutext);
10941094
10951095      if (!sub_menu && create_sub_menu)
10961096      {
r7091r7092
11501150   TCHAR *t_str = str ? tstring_from_utf8(str) : NULL;
11511151   AppendMenu(menu, flags, id, t_str);
11521152   if (t_str)
1153      free(t_str);
1153      global_free(t_str);
11541154}
11551155
11561156
r7091r7092
14391439      TCHAR *t_view_name = tstring_from_utf8(view_name);
14401440      InsertMenu(video_menu, i, MF_BYPOSITION | (i == view_index ? MF_CHECKED : 0),
14411441         ID_VIDEO_VIEW_0 + i, t_view_name);
1442      free(t_view_name);
1442      global_free(t_view_name);
14431443      i++;
14441444   }
14451445
r7091r7092
16481648   {
16491649      TCHAR *t_chapter = tstring_from_utf8(chapter);
16501650      htmlhelp(wnd, t_chapter, 0 /*HH_DISPLAY_TOPIC*/, 0);
1651      free(t_chapter);
1651      global_free(t_chapter);
16521652   }
16531653}
16541654
r7091r7092
19941994   SetMenuItemInfo(menu_bar, command, FALSE, &mii);
19951995
19961996   // cleanup
1997   free(t_text);
1997   global_free(t_text);
19981998}
19991999
20002000
src/mess/osd/windows/winmess.c
r7091r7092
6969   GetTempPath(ARRAY_LENGTH(tempbuf), tempbuf);
7070   t_filename = tstring_from_utf8(basename);
7171   _tcscat(tempbuf, t_filename);
72   free(t_filename);
72   global_free(t_filename);
7373   DeleteFile(tempbuf);
7474
7575   u_tempbuf = utf8_from_tstring(tempbuf);
7676   snprintf(buffer, buffer_len, "%s", u_tempbuf);
77   free(u_tempbuf);
77   global_free(u_tempbuf);
7878
7979   return FILERR_NONE;
8080}
r7091r7092
127127
128128   // create an osd_directory_entry; be sure to make sure that the caller can
129129   // free all resources by just freeing the resulting osd_directory_entry
130   result = (osd_directory_entry *) malloc(sizeof(*result) + strlen(path) + 1);
130   result = (osd_directory_entry *)global_alloc_array_clear(UINT8,sizeof(*result) + strlen(path) + 1);
131131   if (!result)
132132      goto done;
133133   strcpy(((char *) result) + sizeof(*result), path);
r7091r7092
137137
138138done:
139139   if (t_path != NULL)
140      free(t_path);
140      global_free(t_path);
141141   return result;
142142}
143143
r7091r7092
168168      return NULL;
169169
170170   // allocate space for it
171   dirname = (char*)malloc(strlen(filename) + 1);
171   dirname = (char*)global_alloc_array_clear(char,strlen(filename) + 1);
172172   if (!dirname)
173173      return NULL;
174174
r7091r7092
249249
250250done:
251251   if (t_path != NULL)
252      free(t_path);
252      global_free(t_path);
253253   return err;
254254}
255255
r7091r7092
277277
278278done:
279279   if (tempstr)
280      free(tempstr);
280      global_free(tempstr);
281281   return filerr;
282282}
283283
r7091r7092
305305
306306done:
307307   if (tempstr)
308      free(tempstr);
308      global_free(tempstr);
309309   return filerr;
310310}
311311
r7091r7092
336336
337337done:
338338   if (tempstr)
339      free(tempstr);
339      global_free(tempstr);
340340   return filerr;
341341}
342342
r7091r7092
364364
365365done:
366366   if (tempstr)
367      free(tempstr);
367      global_free(tempstr);
368368   return filerr;
369369}
370370
src/mess/zippath.c
r7091r7092
350350   if (temp2 != NULL)
351351      astring_free(temp2);
352352   if (alloc_fullpath != NULL)
353      free(alloc_fullpath);
353      global_free(alloc_fullpath);
354354   return filerr;
355355}
356356

Previous 15994 Revisions Next


© 1998-2018 The MESS Team