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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
/!\ 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 --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;
 		}
 
-- 
2.34.1




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux