]> git.alsa-project.org Git - alsa-plugins.git/commitdiff
usb_stream: Check for NULL-ness before dereferencing
authorMichaël Cadilhac <michael@cadilhac.name>
Mon, 22 Feb 2010 08:59:26 +0000 (09:59 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 22 Feb 2010 09:00:04 +0000 (10:00 +0100)
 * usb_stream/pcm_usb_stream.c (snd_pcm_us_stop): Prevent
   dereferencing when structure is not initialized.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
usb_stream/pcm_usb_stream.c

index 4097693a6950ca34831793fccdb3b2c8c10a42ce..cd761fb252bcb42d5ad4d6024581a09d49180d34 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  PCM - USB_STREAM plugin
  *
- *  Copyright (c) 2008 by Karsten Wiese <fzu@wemgehoertderstaat.de>
+ *  Copyright (c) 2008, 2010 by Karsten Wiese <fzu@wemgehoertderstaat.de>
  *
  * 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);