]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
lad_dealloc(): if xp->x_fd == -1, it means the descriptor's already
authorBarry Warsaw <barry@python.org>
Fri, 18 Aug 2000 05:10:45 +0000 (05:10 +0000)
committerBarry Warsaw <barry@python.org>
Fri, 18 Aug 2000 05:10:45 +0000 (05:10 +0000)
been closed.  Don't try to reclose it.  Found by Insure.

Modules/linuxaudiodev.c

index b0677efb3308288e5d85faa800a9c8f45ea2a705..5bcbaf2854da5ff8df108252029b053ccacdd71b 100644 (file)
@@ -110,7 +110,9 @@ newladobject(PyObject *arg)
 static void
 lad_dealloc(lad_t *xp)
 {
-    close(xp->x_fd);
+    /* if already closed, don't reclose it */
+    if (xp->x_fd != -1)
+       close(xp->x_fd);
     PyObject_Del(xp);
 }