aboutsummaryrefslogtreecommitdiff
path: root/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c
diff options
context:
space:
mode:
authorJorge Lopez <[email protected]>2023-07-31 15:31:34 -0500
committerHans de Goede <[email protected]>2023-08-07 13:34:30 +0200
commit467d41638113b6cab28f5c87dced2fa1f9527479 (patch)
treecb63cd26d2b36f713693b12aa9a36d064899d68c /drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c
parentb0bfa7972bd61cba05ae3619e064d6a0b8b11e63 (diff)
platform/x86: hp-bioscfg: Fix memory leaks in attribute packages
Address memory leaks while handling elements in packages. Signed-off-by: Jorge Lopez <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
Diffstat (limited to 'drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c')
-rw-r--r--drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c
index b1b241f0205a..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;
}
@@ -224,6 +225,7 @@ static int hp_populate_enumeration_elements_from_package(union acpi_object *enum
sizeof(enum_data->common.prerequisites[reqs]));
kfree(str_value);
+ str_value = NULL;
}
break;
@@ -275,6 +277,9 @@ static int hp_populate_enumeration_elements_from_package(union acpi_object *enum
strscpy(enum_data->possible_values[pos_values],
str_value,
sizeof(enum_data->possible_values[pos_values]));
+
+ kfree(str_value);
+ str_value = NULL;
}
break;
default:
@@ -283,6 +288,7 @@ static int hp_populate_enumeration_elements_from_package(union acpi_object *enum
}
kfree(str_value);
+ str_value = NULL;
}
exit_enumeration_package: