From 564f89036fbecfc03ca4152e9de8b291887111a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Fran=C3=A7ois=20Natali?= Date: Thu, 29 Sep 2011 19:43:01 +0200 Subject: [PATCH] Issue #13058: ossaudiodev: fix a file descriptor leak on error. Patch by Thomas Jarosch. --- Misc/ACKS | 1 + Misc/NEWS | 3 +++ Modules/ossaudiodev.c | 1 + 3 files changed, 5 insertions(+) diff --git a/Misc/ACKS b/Misc/ACKS index 6c02a79c7a8..5fd0bfa5da0 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -402,6 +402,7 @@ Kjetil Jacobsen Geert Jansen Jack Jansen Bill Janssen +Thomas Jarosch Drew Jenkins Flemming Kjær Jensen Jiba diff --git a/Misc/NEWS b/Misc/NEWS index 132ea5e08b9..ddcbde11af4 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -50,6 +50,9 @@ Core and Builtins 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 b3dfa625631..647a21e811b 100644 --- a/Modules/ossaudiodev.c +++ b/Modules/ossaudiodev.c @@ -129,6 +129,7 @@ newossobject(PyObject *arg) } if (ioctl(fd, SNDCTL_DSP_GETFMTS, &afmts) == -1) { + close(fd); PyErr_SetFromErrnoWithFilename(PyExc_IOError, devicename); return NULL; }