hal: fix LLVM issues
Fix potential memory leak issue in add_new_sndcard
and monitor_thread_loop
Change-Id: I62b8b1457e27377f3ec9e05d2fbf566ab22358ed
diff --git a/hal/audio_extn/sndmonitor.c b/hal/audio_extn/sndmonitor.c
index dd7f92f..1860cad 100644
--- a/hal/audio_extn/sndmonitor.c
+++ b/hal/audio_extn/sndmonitor.c
@@ -153,9 +153,10 @@
char *state = read_state(fd);
- if (!state)
+ if (!state) {
+ free(s);
return -1;
-
+ }
bool online = state && !strcmp(state, "ONLINE");
ALOGV("card %d initial state %s %d", card, state, online);
@@ -547,7 +548,8 @@
++i;
}
}
-
+ if (pfd)
+ free(pfd);
return NULL;
}