audio: hal: Fix for memory leaks.
Change-Id: I3206b5a05869f3eb2c4dffaaf44ebf4ce0f08b4a
diff --git a/hal/acdb.c b/hal/acdb.c
index 8dfcc2c..4b1ef31 100644
--- a/hal/acdb.c
+++ b/hal/acdb.c
@@ -4,6 +4,10 @@
*
* Copyright (C) 2013 The Android Open Source Project
*
+ * Changes from Qualcomm Innovation Center are provided under the following license:
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * SPDX-License-Identifier: BSD-3-Clause-Clear
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -243,6 +247,19 @@
list_remove(node);
free(key_info);
}
+
+ if (result < 0) {
+
+ if (snd_card_name)
+ free((void *)snd_card_name);
+
+ if (my_data->acdb_init_data.snd_card_name)
+ free(my_data->acdb_init_data.snd_card_name);
+
+ if (my_data)
+ platform_info_deinit();
+ }
+
free(my_data);
}