Fixed USB device disconnect: clear save/restore list before deleting device
(bug found with valgrind).
This commit is contained in:
parent
7da8cfa4b0
commit
946a6bf50e
@ -5,7 +5,7 @@
|
||||
// USB hub emulation support (ported from QEMU)
|
||||
//
|
||||
// Copyright (C) 2005 Fabrice Bellard
|
||||
// Copyright (C) 2009-2014 The Bochs Project
|
||||
// Copyright (C) 2009-2015 The Bochs Project
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@ -591,11 +591,11 @@ void usb_hub_device_c::remove_device(Bit8u port)
|
||||
char pname[BX_PATHNAME_LEN];
|
||||
|
||||
if (hub.usb_port[port].device != NULL) {
|
||||
delete hub.usb_port[port].device;
|
||||
hub.usb_port[port].device = NULL;
|
||||
sprintf(pname, "port%d.device", port+1);
|
||||
bx_list_c *devlist = (bx_list_c*)SIM->get_param(pname, hub.state);
|
||||
devlist->clear();
|
||||
delete hub.usb_port[port].device;
|
||||
hub.usb_port[port].device = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
// USB hub emulation support (ported from QEMU)
|
||||
//
|
||||
// Copyright (C) 2005 Fabrice Bellard
|
||||
// Copyright (C) 2009-2012 The Bochs Project
|
||||
// Copyright (C) 2009-2015 The Bochs Project
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -516,11 +516,11 @@ void bx_usb_ohci_c::remove_device(Bit8u port)
|
||||
char pname[BX_PATHNAME_LEN];
|
||||
|
||||
if (BX_OHCI_THIS hub.usb_port[port].device != NULL) {
|
||||
delete BX_OHCI_THIS hub.usb_port[port].device;
|
||||
BX_OHCI_THIS hub.usb_port[port].device = NULL;
|
||||
sprintf(pname, "usb_ohci.hub.port%d.device", port+1);
|
||||
bx_list_c *devlist = (bx_list_c*)SIM->get_param(pname, SIM->get_bochs_root());
|
||||
devlist->clear();
|
||||
delete BX_OHCI_THIS hub.usb_port[port].device;
|
||||
BX_OHCI_THIS hub.usb_port[port].device = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -374,11 +374,11 @@ void bx_usb_uhci_c::remove_device(Bit8u port)
|
||||
char pname[BX_PATHNAME_LEN];
|
||||
|
||||
if (BX_UHCI_THIS hub.usb_port[port].device != NULL) {
|
||||
delete BX_UHCI_THIS hub.usb_port[port].device;
|
||||
BX_UHCI_THIS hub.usb_port[port].device = NULL;
|
||||
sprintf(pname, "usb_uhci.hub.port%d.device", port+1);
|
||||
bx_list_c *devlist = (bx_list_c*)SIM->get_param(pname, SIM->get_bochs_root());
|
||||
devlist->clear();
|
||||
delete BX_UHCI_THIS hub.usb_port[port].device;
|
||||
BX_UHCI_THIS hub.usb_port[port].device = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -936,11 +936,11 @@ void bx_usb_xhci_c::remove_device(Bit8u port)
|
||||
char pname[BX_PATHNAME_LEN];
|
||||
|
||||
if (BX_XHCI_THIS hub.usb_port[port].device != NULL) {
|
||||
delete BX_XHCI_THIS hub.usb_port[port].device;
|
||||
BX_XHCI_THIS hub.usb_port[port].device = NULL;
|
||||
sprintf(pname, "usb_xhci.hub.port%d.device", port+1);
|
||||
bx_list_c *devlist = (bx_list_c*)SIM->get_param(pname, SIM->get_bochs_root());
|
||||
if (devlist) devlist->clear();
|
||||
delete BX_XHCI_THIS hub.usb_port[port].device;
|
||||
BX_XHCI_THIS hub.usb_port[port].device = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user