Skip to contentSkip to conversation

hw/arm/iotkit.c: fix minor memory leak

PATCH In review Peter Maydell 3 participants 4 messages Apr 27, 2018 – May 8, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/arm/iotkit.c: fix minor memory leak

Coverity (CID1390573) spots that we forgot to free the gpioname strings in a loop in the iotkit realize function. Correct the error.

This isn't a significant leak, because this function only ever runs once.

---
 hw/arm/iotkit.c | 1 +
 1 file changed, 1 insertion(+)
hw/arm/iotkit.c +1 -0
index c5f0a5b98a..234185e8f7 100644
@@ -517,6 +517,7 @@ static void iotkit_realize(DeviceState *dev, Error **errp)
                               qdev_get_gpio_in(DEVICE(&s->ppc_irq_orgate), i));
         qdev_connect_gpio_out_named(DEVICE(ppc), "irq", 0,
                                     qdev_get_gpio_in(devs, 0));
+        g_free(gpioname);
     }
 
     iotkit_forward_sec_resp_cfg(s);
Signature · 1 line
2.17.0
#1 lore raw

ping for review?

thanks
-- PMM

Quoted 26 lines · Peter Maydell

Coverity (CID1390573) spots that we forgot to free the gpioname strings in a loop in the iotkit realize function. Correct the error.

This isn't a significant leak, because this function only ever runs once.

---
 hw/arm/iotkit.c | 1 +
 1 file changed, 1 insertion(+)
hw/arm/iotkit.c +1 -1
index c5f0a5b98a..234185e8f7 100644
@@ -517,6 +517,7 @@ static void iotkit_realize(DeviceState *dev, Error **errp)
                               qdev_get_gpio_in(DEVICE(&s->ppc_irq_orgate), i));
         qdev_connect_gpio_out_named(DEVICE(ppc), "irq", 0,
                                     qdev_get_gpio_in(devs, 0));
+        g_free(gpioname);
     }
 
     iotkit_forward_sec_resp_cfg(s);
--

2.17.0

#2 lore raw
Quoted 14 lines · Peter Maydell

ping for review?

thanks
-- PMM

Quoted 8 lines · Peter Maydell

Coverity (CID1390573) spots that we forgot to free the gpioname strings in a loop in the iotkit realize function. Correct the error.

This isn't a significant leak, because this function only ever runs once.

Quoted 19 lines
Quoted 18 lines
---
 hw/arm/iotkit.c | 1 +
 1 file changed, 1 insertion(+)
hw/arm/iotkit.c +1 -1
index c5f0a5b98a..234185e8f7 100644
@@ -517,6 +517,7 @@ static void iotkit_realize(DeviceState *dev, Error **errp)
                               qdev_get_gpio_in(DEVICE(&s->ppc_irq_orgate), i));
         qdev_connect_gpio_out_named(DEVICE(ppc), "irq", 0,
                                     qdev_get_gpio_in(devs, 0));
+        g_free(gpioname);
     }
 
     iotkit_forward_sec_resp_cfg(s);
--

2.17.0

Reviewed-by on v1 1/1
#3 lore raw
In reply to Peter Maydell
Quoted 8 lines · Peter Maydell

Coverity (CID1390573) spots that we forgot to free the gpioname strings in a loop in the iotkit realize function. Correct the error.

This isn't a significant leak, because this function only ever runs once.

I believe this even does not require ARM knowledges, so:

Quoted 20 lines
---
 hw/arm/iotkit.c | 1 +
 1 file changed, 1 insertion(+)
hw/arm/iotkit.c +1 -0
index c5f0a5b98a..234185e8f7 100644
@@ -517,6 +517,7 @@ static void iotkit_realize(DeviceState *dev, Error **errp)
                               qdev_get_gpio_in(DEVICE(&s->ppc_irq_orgate), i));
         qdev_connect_gpio_out_named(DEVICE(ppc), "irq", 0,
                                     qdev_get_gpio_in(devs, 0));
+        g_free(gpioname);
     }
 
     iotkit_forward_sec_resp_cfg(s);
Signature · 1 line
2.17.0
Signature · 1 line
Peter Xu