Fix a memory management bug in apply_drive_changes to stop winecfg

deleting all the drive definitions in some cases.
This commit is contained in:
Mike Hearn 2005-01-09 18:01:00 +00:00 committed by Alexandre Julliard
parent b889e29eb6
commit 63afcfebff
1 changed files with 9 additions and 6 deletions

View File

@ -180,6 +180,15 @@ void load_drives()
{ {
drives[i].letter = 'A' + i; drives[i].letter = 'A' + i;
drives[i].in_use = FALSE; drives[i].in_use = FALSE;
HeapFree(GetProcessHeap(), 0, drives[i].unixpath);
drives[i].unixpath = NULL;
HeapFree(GetProcessHeap(), 0, drives[i].label);
drives[i].label = NULL;
HeapFree(GetProcessHeap(), 0, drives[i].serial);
drives[i].serial = NULL;
} }
/* work backwards through the result of GetLogicalDriveStrings */ /* work backwards through the result of GetLogicalDriveStrings */
@ -473,11 +482,5 @@ void apply_drive_changes()
WINE_TRACE(" CreateFile() error with file '%s'\n", filename); WINE_TRACE(" CreateFile() error with file '%s'\n", filename);
} }
} }
/* if this drive is in use we should free it up */
if(drives[i].in_use)
{
delete_drive(&drives[i]); /* free up the string memory */
}
} }
} }