History

gpio: regmap: fix memory leak of gpio_regmap structure

The gpio_regmap structure is leaked on the error path. Fix this by jumping to the appropriate kfree instead of returning directly.

Ioana Ciornei committed 1 year ago

Commit 3bd44ed1 parent c6ccc4d1 file · +1 −1Browse files

Unified · Split

drivers/gpio/gpio-regmap.c+1−1
@@ -274,7 +274,7 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config · 273 unmodified lines
274274 if (!chip->ngpio) {
275275 ret = gpiochip_get_ngpios(chip, chip->parent);
276276 if (ret)
277− return ERR_PTR(ret);
277+ goto err_free_gpio;
278278 }
279279
280280 /* if not set, assume there is only one register */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t