audio: hal: Avoid deallocated memory access
[Issue] : Enable disable BT multiple times causing segmentation fault.
[Root cause] : Trying to access the pointer which is already freed.
[Fix] : Updating pointer with NULL after deallocation.
Change-Id: I763e4c874d4fab92c6d75315ea96a613dfdcb131
diff --git a/hal/platform_info.c b/hal/platform_info.c
index 80b6e0d..431ebe4 100644
--- a/hal/platform_info.c
+++ b/hal/platform_info.c
@@ -28,7 +28,7 @@
* Changes from Qualcomm Innovation Center are provided under the following license:
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022, 2023 Qualcomm Innovation Center, Inc. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted (subject to the limitations in the
@@ -1732,6 +1732,8 @@
void platform_info_deinit()
{
- if (my_data.kvpairs)
+ if (my_data.kvpairs) {
str_parms_destroy(my_data.kvpairs);
+ my_data.kvpairs = NULL;
+ }
}