[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.
This commit is contained in:
parent
84772e0ab4
commit
b2aefd77e1
|
@ -0,0 +1 @@
|
|||
Fix linuxaudiodev.linux_audio_device() error handling: close the internal file descriptor if it fails to open the device.
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue