Issue #13058: ossaudiodev: fix a file descriptor leak on error. Patch by Thomas
Jarosch.
diff --git a/Misc/ACKS b/Misc/ACKS
index 06feb0b..bc5e745 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -463,6 +463,7 @@
 Geert Jansen
 Jack Jansen
 Bill Janssen
+Thomas Jarosch
 Julien Jehannet
 Drew Jenkins
 Flemming Kjær Jensen
diff --git a/Misc/NEWS b/Misc/NEWS
index 6ec36dd..3d6b317 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -1298,6 +1298,9 @@
 Extension Modules
 -----------------
 
+- Issue #13058: ossaudiodev: fix a file descriptor leak on error. Patch by
+  Thomas Jarosch.
+
 - Issue #13013: ctypes: Fix a reference leak in PyCArrayType_from_ctype.
   Thanks to Suman Saha for finding the bug and providing a patch.
 
diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c
index bcab9da..f0fe8c2 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;
     }