[bus] Make callers of bus__add_child responsible...
[people/sha0/winvblock.git] / src / winvblock / filedisk / grub4dos.c
index 137994d..8a9cc35 100644 (file)
@@ -493,7 +493,9 @@ filedisk_grub4dos__find (
            Grub4DosDriveMapSlotPtr[i].SourceDrive;
          filedisk_ptr->disk->BootDrive = TRUE;
          FoundGrub4DosMapping = TRUE;
-         bus__add_child(driver__bus(), filedisk_ptr->disk->device);
+         /* Add the filedisk to the bus. */
+         if (!bus__add_child(driver__bus(), filedisk_ptr->disk->device))
+      device__free(filedisk_ptr->disk->device);
        }
       InterruptVector = &SafeMbrHookPtr->PrevHook;
     }