diff options
author | stratakis <cstratak@redhat.com> | 2019-03-06 14:11:56 (GMT) |
---|---|---|
committer | Victor Stinner <vstinner@redhat.com> | 2019-03-06 14:11:56 (GMT) |
commit | b2aefd77e1da438aed649d018d6aa504ec35eac8 (patch) | |
tree | 73c1c2a3b4bee2dfd2f26f3ee2d5a0d4feab4b27 /Modules | |
parent | 84772e0ab49ee09acb44e30551aa5cfc1eafe5dc (diff) | |
download | cpython-b2aefd77e1da438aed649d018d6aa504ec35eac8.zip cpython-b2aefd77e1da438aed649d018d6aa504ec35eac8.tar.gz cpython-b2aefd77e1da438aed649d018d6aa504ec35eac8.tar.bz2 |
[2.7] bpo-36186: Fix linuxaudiodev.linux_audio_device() error handling (GH-12163)
Fix linuxaudiodev.linux_audio_device() error handling:
close the internal file descriptor if it fails to open the device.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/linuxaudiodev.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/linuxaudiodev.c b/Modules/linuxaudiodev.c index 7fe20ae..f5135d9 100644 --- a/Modules/linuxaudiodev.c +++ b/Modules/linuxaudiodev.c @@ -126,10 +126,12 @@ newladobject(PyObject *arg) } if (imode == O_WRONLY && ioctl(fd, SNDCTL_DSP_NONBLOCK, NULL) == -1) { PyErr_SetFromErrnoWithFilename(LinuxAudioError, basedev); + close(fd); return NULL; } if (ioctl(fd, SNDCTL_DSP_GETFMTS, &afmts) == -1) { PyErr_SetFromErrnoWithFilename(LinuxAudioError, basedev); + close(fd); return NULL; } /* Create and initialize the object */ |