From ffb006dd4ab9d435e5c0623bd31c2bcecaf3a465 Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Wed, 23 Feb 2022 11:03:30 +0100 Subject: [PATCH] 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 --- tests/gpiosim/gpiosim.c | 2 ++ 1 file changed, 2 insertions(+) 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); } -- 2.30.2