Commit 79eeab1d authored by Bartosz Golaszewski's avatar Bartosz Golaszewski
Browse files

gpio: sim: fix a memory leak



Fix an inverted logic bug in gpio_sim_remove_hogs() that leads to GPIO
hog structures never being freed.

Fixes: cb8c474e ("gpio: sim: new testing module")
Reported-by: default avatarMirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent b8b3b0bf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -736,7 +736,7 @@ static void gpio_sim_remove_hogs(struct gpio_sim_device *dev)

	gpiod_remove_hogs(dev->hogs);

	for (hog = dev->hogs; !hog->chip_label; hog++) {
	for (hog = dev->hogs; hog->chip_label; hog++) {
		kfree(hog->chip_label);
		kfree(hog->line_name);
	}