[PATCH] alsactl: Fix potential NULL dereferences in daemon mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---

Something I forgot to merge, casually found in the working directory...

 alsactl/daemon.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/alsactl/daemon.c b/alsactl/daemon.c
index 127701efaf0f..4f0a935a3987 100644
--- a/alsactl/daemon.c
+++ b/alsactl/daemon.c
@@ -451,8 +451,10 @@ save:
 out:
 	free(pfd);
 	remove(pidfile);
-	for (i = 0; i < count; i++)
-		card_free(&cards[i]);
-	free(cards);
+	if (cards) {
+		for (i = 0; i < count; i++)
+			card_free(&cards[i]);
+		free(cards);
+	}
 	return 0;
 }
-- 
2.11.0

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux