From 63afcfebff18bf306646cfc1b0917ecce83bd5be Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Sun, 9 Jan 2005 18:01:00 +0000 Subject: [PATCH] Fix a memory management bug in apply_drive_changes to stop winecfg deleting all the drive definitions in some cases. --- programs/winecfg/drive.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/programs/winecfg/drive.c b/programs/winecfg/drive.c index f44b82888b6..a1a5bbc1c49 100644 --- a/programs/winecfg/drive.c +++ b/programs/winecfg/drive.c @@ -180,6 +180,15 @@ void load_drives() { drives[i].letter = 'A' + i; 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 */ @@ -473,11 +482,5 @@ void apply_drive_changes() 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 */ - } } }