@samitouri / QOSamiQemu / commits / cc177661ab

hw/arm/aspeed_gpio: Don't leak string in aspeed_gpio_init()

We allocate the string for the GPIO property name, but never free it. Use g_autofree to avoid this. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Cédric Le Goater <clg@redhat.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20260302092225.4088227-4-peter.maydell@linaro.org

Peter Maydell committed Mar 6, 2026 at 09:01 UTC cc177661ab592a69bd39524aa7d095345b5031df
1 file changed +1 -1
hw/gpio/aspeed_gpio.c
+1 -1
@@ -1488,7 +1488,7 @@ static void aspeed_gpio_init(Object *obj)
1488 }
1489
1490 for (int i = 0; i < agc->nr_gpio_sets; i++) {
1491 - char *name = g_strdup_printf("gpio-set[%d]", i);
1491 + g_autofree char *name = g_strdup_printf("gpio-set[%d]", i);
1492 object_property_add(obj, name, "uint32", aspeed_gpio_get_set,
1493 aspeed_gpio_set_set, NULL, NULL);
1494 }