mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
Don't set PCM pointer at error in snd_pcm_hw_open()
snd_pcm_hw_open() may set a non-NULL to pcmp even if it returns an error. Some codes like dmix expects it's NULL, and cause the double free().
This commit is contained in:
parent
fca29a6172
commit
c7e1676dcd
1 changed files with 2 additions and 2 deletions
|
|
@ -1015,8 +1015,6 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name,
|
|||
pcm->poll_fd = fd;
|
||||
pcm->poll_events = info.stream == SND_PCM_STREAM_PLAYBACK ? POLLOUT : POLLIN;
|
||||
|
||||
*pcmp = pcm;
|
||||
|
||||
ret = snd_pcm_hw_mmap_status(pcm);
|
||||
if (ret < 0) {
|
||||
snd_pcm_close(pcm);
|
||||
|
|
@ -1027,6 +1025,8 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name,
|
|||
snd_pcm_close(pcm);
|
||||
return ret;
|
||||
}
|
||||
|
||||
*pcmp = pcm;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue