audio: close dlopen'ed library on error

Close dlopen'ed perf library on error

Bug: 64764754
Change-Id: I70e4cd95e97ffac116f83d1949f4dbe78d8f944d
CRs-Fixed: 2047997
diff --git a/hal/audio_extn/audio_extn.c b/hal/audio_extn/audio_extn.c
index e5d7db4..4edbf9b 100644
--- a/hal/audio_extn/audio_extn.c
+++ b/hal/audio_extn/audio_extn.c
@@ -118,6 +118,8 @@
                                                        "perf_lock_acq");
             if (perf_lock_acq == NULL) {
                 ALOGE("%s: Perf lock Acquire NULL", __func__);
+                dlclose(qcopt_handle);
+                qcopt_handle = NULL;
                 ret = -EINVAL;
                 goto err;
             }
@@ -125,6 +127,8 @@
                                                        "perf_lock_rel");
             if (perf_lock_rel == NULL) {
                 ALOGE("%s: Perf lock Release NULL", __func__);
+                dlclose(qcopt_handle);
+                qcopt_handle = NULL;
                 ret = -EINVAL;
                 goto err;
             }