tinyalsa: check NULL for config
pcm_open() was not checking config and crashed memory leak
Test: built and ran on device without errors
Change-Id: Icdd6271b0c5d6107b8bfc043f26a63b2829712b3
diff --git a/pcm.c b/pcm.c
index 120d182..4ae321b 100644
--- a/pcm.c
+++ b/pcm.c
@@ -882,8 +882,11 @@
char fn[256];
int rc;
+ if (!config) {
+ return &bad_pcm; /* TODO: could support default config here */
+ }
pcm = calloc(1, sizeof(struct pcm));
- if (!pcm || !config)
+ if (!pcm)
return &bad_pcm; /* TODO: could support default config here */
pcm->config = *config;