mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-19 08:02:15 -06:00
ide: ahci: call cleanup function in ahci unit
This can avoid memory leak when hotunplug the ahci device. Signed-off-by: Li Qiang <liqiang6-s@360.cn> Message-id: 1488449293-80280-4-git-send-email-liqiang6-s@360.cn Signed-off-by: John Snow <jsnow@redhat.com>
This commit is contained in:
parent
c9f086418a
commit
d68f0f778e
1 changed files with 12 additions and 0 deletions
|
@ -1485,6 +1485,18 @@ void ahci_realize(AHCIState *s, DeviceState *qdev, AddressSpace *as, int ports)
|
||||||
|
|
||||||
void ahci_uninit(AHCIState *s)
|
void ahci_uninit(AHCIState *s)
|
||||||
{
|
{
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
for (i = 0; i < s->ports; i++) {
|
||||||
|
AHCIDevice *ad = &s->dev[i];
|
||||||
|
|
||||||
|
for (j = 0; j < 2; j++) {
|
||||||
|
IDEState *s = &ad->port.ifs[j];
|
||||||
|
|
||||||
|
ide_exit(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
g_free(s->dev);
|
g_free(s->dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue