Previous 15994 Revisions Next

r7935 Thursday 29th April, 2010 at 14:32:20 UTC by Firewave
[WIMGTOOL] More "proper" free call usage and variable prefix additions
[src/mess/tools/imgtool/windows]wimgtool.c

src/mess/tools/imgtool/windows/wimgtool.c
r7934r7935
8282   if (t_filename != NULL)
8383   {
8484      result = GetFileAttributes(t_filename);
85      free(t_filename);
85      global_free(t_filename);
8686   }
8787   return result;
8888}
r7934r7935
15341534   imgtoolerr_t err = IMGTOOLERR_SUCCESS;
15351535   struct createdir_dialog_info cdi;
15361536   wimgtool_info *info;
1537   char *dirname = NULL;
1537   char *utf8_dirname = NULL;
15381538   char *s;
15391539
15401540   info = get_wimgtool_info(window);
r7934r7935
15451545
15461546   if (cdi.buf[0] == '\0')
15471547      goto done;
1548   dirname = utf8_from_tstring(cdi.buf);
1548   utf8_dirname = utf8_from_tstring(cdi.buf);
15491549
15501550   if (info->current_directory)
15511551   {
1552      s = (char *) alloca(strlen(info->current_directory) + strlen(dirname) + 1 + 1);
1552      s = (char *) alloca(strlen(info->current_directory) + strlen(utf8_dirname) + 1 + 1);
15531553      strcpy(s, info->current_directory);
15541554      strcat(s, "\\");
1555      strcat(s, dirname);
1556      free(dirname);
1557      dirname = mame_strdup(s);
1555      strcat(s, utf8_dirname);
1556      global_free(utf8_dirname);
1557      utf8_dirname = mame_strdup(s);
15581558   }
15591559
1560   err = imgtool_partition_create_directory(info->partition, dirname);
1560   err = imgtool_partition_create_directory(info->partition, utf8_dirname);
15611561   if (err)
15621562      goto done;
15631563
r7934r7935
15671567
15681568done:
15691569   if (err)
1570      wimgtool_report_error(window, err, NULL, dirname);
1571   if (dirname)
1572      free(dirname);
1570      wimgtool_report_error(window, err, NULL, utf8_dirname);
1571   if (utf8_dirname)
1572      global_free(utf8_dirname);
15731573}
15741574
15751575

Previous 15994 Revisions Next


© 1998-2018 The MESS Team