Fix a memory corruption bug

Mike Hearn mike at navi.cx
Fri Jan 7 10:24:19 CST 2005


Mike Hearn <mike at navi.cx>
Fix a memory management bug in apply_drive_changes to stop winecfg deleting all the drive definitions in some cases.

--- programs/winecfg/drive.c  (revision 73)
+++ programs/winecfg/drive.c  (revision 75)
@@ -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  */
@@ -478,11 +487,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 */
-        }
     }
 }



More information about the wine-patches mailing list