alsactl: Fix potential NULL dereferences in daemon mode

The code releasing the each card object may access to NULL when a
bogus count is given.  Add a NULL check just to make sure.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2016-12-09 17:28:47 +01:00
parent 9ea2a1d067
commit 9839813e7c

View file

@ -451,8 +451,10 @@ save:
out:
free(pfd);
remove(pidfile);
if (cards) {
for (i = 0; i < count; i++)
card_free(&cards[i]);
free(cards);
}
return 0;
}