Skip to content

Commit

Permalink
[2.7] bpo-36186: Fix linuxaudiodev.linux_audio_device() error handling (
Browse files Browse the repository at this point in the history
GH-12163)

Fix linuxaudiodev.linux_audio_device() error handling:
close the internal file descriptor if it fails to open the device.
  • Loading branch information
stratakis authored and vstinner committed Mar 6, 2019
1 parent 84772e0 commit b2aefd7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
@@ -0,0 +1 @@
Fix linuxaudiodev.linux_audio_device() error handling: close the internal file descriptor if it fails to open the device.
2 changes: 2 additions & 0 deletions Modules/linuxaudiodev.c
Expand Up @@ -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 */
Expand Down

0 comments on commit b2aefd7

Please sign in to comment.