tinyalsa: fix double free crash in pcm_close

Pcm data and snd_node will be released if pcm_open() encounters error
condition after plugin open, but valid pcm pointer is still returned.
If client invokes pcm_close() later, pcm data and snd_node will be freed
again which results into crash. Add NULL pointer check to avoid same
resource being freed twice.

Bug: 166482201
Test: audio smoke tests

Change-Id: Ic8a1976efc3add17bb0200fdf6d2bdc583ee1a49
Signed-off-by: Weiyin Jiang <wjiang@codeaurora.org>
1 file changed