From: Bartosz Golaszewski Date: Wed, 23 Feb 2022 10:03:30 +0000 (+0100) Subject: gpiosim: fix a memory leak X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=ffb006dd4ab9d435e5c0623bd31c2bcecaf3a465;p=qemu-gpiodev%2Flibgpiod.git gpiosim: fix a memory leak If a bank gets dropped when the device is still enabled and before the parent device, we leak the device path and chip name strings. This makes sure we always free them. Signed-off-by: Bartosz Golaszewski --- diff --git a/tests/gpiosim/gpiosim.c b/tests/gpiosim/gpiosim.c index 1429b7e..338fbc1 100644 --- a/tests/gpiosim/gpiosim.c +++ b/tests/gpiosim/gpiosim.c @@ -748,6 +748,8 @@ static void bank_release(struct refcount *ref) gpiosim_dev_unref(dev); close(bank->cfs_dir_fd); free(bank->item_name); + free(bank->chip_name); + free(bank->dev_path); free(bank); }