Make mkpath allocate the string buffer for map_filename. Fixes 2119.

This commit is contained in:
Chris Young 2014-05-10 15:22:38 +01:00
parent 7dc170e6d8
commit 318edea47e
1 changed files with 6 additions and 2 deletions

View File

@ -393,14 +393,16 @@ STRPTR ami_locale_langs(void)
bool ami_gui_map_filename(char **remapped, const char *path, const char *file, const char *map)
{
BPTR fh = 0;
char mapfile[1024];
size_t mapfile_size = 1024;
char *mapfile = NULL;
size_t mapfile_size = 0;
char buffer[1024];
char *realfname;
bool found = false;
amiga_mkpath(&mapfile, &mapfile_size, 2, path, map);
if(mapfile == NULL) return false;
if(fh = FOpen(mapfile, MODE_OLDFILE, 0))
{
while(FGets(fh, buffer, 1024) != 0)
@ -427,6 +429,8 @@ bool ami_gui_map_filename(char **remapped, const char *path, const char *file, c
if(found == false) *remapped = strdup(file);
else LOG(("Remapped %s to %s in path %s using %s", file, *remapped, path, map));
free(mapfile);
return found;
}