From 5a4a1096949335736ccad2b102fd91ebdd2e25b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Fran=C3=A7ois=20Natali?= Date: Thu, 29 Sep 2011 19:46:37 +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 6845faaac62..408d91be853 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -436,6 +436,7 @@ Bertrand Janin Geert Jansen Jack Jansen Bill Janssen +Thomas Jarosch Drew Jenkins Flemming Kjær Jensen MunSic Jeong diff --git a/Misc/NEWS b/Misc/NEWS index b5c75b49cd8..2f6ef7f280a 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -82,6 +82,9 @@ Tests 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 cdf6bebc16e..b38ce5294c0 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; }