diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index bcb9ff9e1b9b5dc2c7dd54c0b9b1bd7ee0aeb781..6defeed81c3a7b791af3becd14528134f2a6cb21 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1478,6 +1478,7 @@ void ahci_realize(AHCIState *s, DeviceState *qdev, AddressSpace *as, int ports)
         ad->port.dma->ops = &ahci_dma_ops;
         ide_register_restart_cb(&ad->port);
     }
+    g_free(irqs);
 }
 
 void ahci_uninit(AHCIState *s)