From e3b3c401bb9f6ff4d428600350a53c952ad1747e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C3=ABl=20Cadilhac?= Date: Mon, 22 Feb 2010 09:59:26 +0100 Subject: [PATCH] usb_stream: Check for NULL-ness before dereferencing * usb_stream/pcm_usb_stream.c (snd_pcm_us_stop): Prevent dereferencing when structure is not initialized. Signed-off-by: Takashi Iwai --- usb_stream/pcm_usb_stream.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/usb_stream/pcm_usb_stream.c b/usb_stream/pcm_usb_stream.c index 4097693..cd761fb 100644 --- a/usb_stream/pcm_usb_stream.c +++ b/usb_stream/pcm_usb_stream.c @@ -1,7 +1,7 @@ /* * PCM - USB_STREAM plugin * - * Copyright (c) 2008 by Karsten Wiese + * Copyright (c) 2008, 2010 by Karsten Wiese * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -256,8 +256,11 @@ static int snd_pcm_us_start(snd_pcm_ioplug_t *io) static int snd_pcm_us_stop(snd_pcm_ioplug_t *io) { snd_pcm_us_t *us = io->private_data; - VDBG("%u", us->uus->s->periods_done); + if (!us->uus->s) + return 0; + + VDBG("%u", us->uus->s->periods_done); if (io->stream == SND_PCM_STREAM_PLAYBACK) memset(us->uus->write_area, 0, us->uus->s->write_size); -- 2.47.1