diff mbox series

platform/x86: hp-bioscfg: Fix another memory leaks in hp_populate_enumeration_elements_from_package()

Message ID 2a60147e2d555a77d348d1bdfec160bc936e1dc6.1689627531.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State Superseded, archived
Headers show
Series platform/x86: hp-bioscfg: Fix another memory leaks in hp_populate_enumeration_elements_from_package() | expand

Commit Message

Christophe JAILLET July 17, 2023, 8:59 p.m. UTC
If the check that both expected and read object type match fails, some
resource may still need to be released.

Add the missing kfree().

Fixes: 6b2770bfd6f9 ("platform/x86: hp-bioscfg: enum-attributes")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
/!\ Speculative /!\

   This patch is based on analysis of the surrounding code and should be
   reviewed with care !

/!\ Speculative /!\
---
 drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c
index dd173020c747..8e615ccfc9b5 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c
@@ -164,6 +164,7 @@  static int hp_populate_enumeration_elements_from_package(union acpi_object *enum
 		if (expected_enum_types[eloc] != enum_obj[elem].type) {
 			pr_err("Error expected type %d for elem %d, but got type %d instead\n",
 			       expected_enum_types[eloc], elem, enum_obj[elem].type);
+			kfree(str_value);
 			return -EIO;
 		}