Issue #13058: ossaudiodev: fix a file descriptor leak on error. Patch by Thomas
Jarosch.
diff --git a/Misc/ACKS b/Misc/ACKS
index 6c02a79..5fd0bfa 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -402,6 +402,7 @@
 Geert Jansen
 Jack Jansen
 Bill Janssen
+Thomas Jarosch
 Drew Jenkins
 Flemming Kjær Jensen
 Jiba
diff --git a/Misc/NEWS b/Misc/NEWS
index 132ea5e..ddcbde1 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -50,6 +50,9 @@
 Library
 -------
 
+- Issue #13058: ossaudiodev: fix a file descriptor leak on error. Patch by
+  Thomas Jarosch.
+
 - Issue #12931: xmlrpclib now encodes Unicode URI to ISO-8859-1, instead of
   failing with a UnicodeDecodeError.
 
diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c
index b3dfa62..647a21e 100644
--- a/Modules/ossaudiodev.c
+++ b/Modules/ossaudiodev.c
@@ -129,6 +129,7 @@
     }
 
     if (ioctl(fd, SNDCTL_DSP_GETFMTS, &afmts) == -1) {
+        close(fd);
         PyErr_SetFromErrnoWithFilename(PyExc_IOError, devicename);
         return NULL;
     }