Skip to contentSkip to conversation

gpio: fix memory leak in aspeed_gpio_init()

PATCH In review [email protected] 2 participants 2 messages Nov 18, 2019 Arm/Aspeed machine support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: fix memory leak in aspeed_gpio_init()

From: PanNengyuan <[email protected]>

Address Sanitizer shows memory leak in hw/gpio/aspeed_gpio.c:875

---
 hw/gpio/aspeed_gpio.c | 1 +
 1 file changed, 1 insertion(+)
hw/gpio/aspeed_gpio.c +1 -0
index 7acc5fa..41e11ea 100644
@@ -876,6 +876,7 @@ static void aspeed_gpio_init(Object *obj)
                                pin_idx % GPIOS_PER_GROUP);
         object_property_add(obj, name, "bool", aspeed_gpio_get_pin,
                             aspeed_gpio_set_pin, NULL, NULL, NULL);
+        g_free(name);
     }
 }
 
Signature · 1 line
2.7.2.windows.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · On 18/11/2019 02:37, [email protected] wrote:

From: PanNengyuan <[email protected]>

Address Sanitizer shows memory leak in hw/gpio/aspeed_gpio.c:875

I will add this patch the series I am building for 5.0.

Thanks,

C.

Quoted 17 lines
---
 hw/gpio/aspeed_gpio.c | 1 +
 1 file changed, 1 insertion(+)
hw/gpio/aspeed_gpio.c +1 -0
index 7acc5fa..41e11ea 100644
@@ -876,6 +876,7 @@ static void aspeed_gpio_init(Object *obj)
                                pin_idx % GPIOS_PER_GROUP);
         object_property_add(obj, name, "bool", aspeed_gpio_get_pin,
                             aspeed_gpio_set_pin, NULL, NULL, NULL);
+        g_free(name);
     }
 }