]> git.alsa-project.org Git - alsa-lib.git/commitdiff
pcm_file: fix SEGFAULT if file option is missing while infile is not.
authorAndrey Mazo <mazo@telum.ru>
Sat, 16 Nov 2013 21:11:54 +0000 (01:11 +0400)
committerTakashi Iwai <tiwai@suse.de>
Sun, 17 Nov 2013 09:15:26 +0000 (10:15 +0100)
Commit 5c5f1358123af69155267463a0b6254ad9cbecc4 requires both file and
infile options to be missing to report a failure.
In fact, only file option is mandatory and should be checked there.
Otherwise, NULL file triggers segfault in
snd_pcm_file_replace_fname() called from
snd_pcm_file_open_output_file().
infile option is optional, so don't report fatal error if it's missing.

Signed-off-by: Andrey Mazo <mazo@telum.ru>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/pcm/pcm_file.c

index 59504019d557487700d0ae46118d17c820d4c388..3d14090fd2ea3ba1dd6b8c17ba55cd66e16688d8 100644 (file)
@@ -948,7 +948,7 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
        err = snd_pcm_slave_conf(root, slave, &sconf, 0);
        if (err < 0)
                return err;
-       if ((!fname || strlen(fname) == 0) && fd < 0 && !ifname) {
+       if ((!fname || strlen(fname) == 0) && fd < 0) {
                snd_config_delete(sconf);
                SNDERR("file is not defined");
                return -EINVAL;