From e4e401127bbd323b220ca07aa08eafd0fb4c0270 Mon Sep 17 00:00:00 2001 From: David King Date: Thu, 20 May 2021 10:06:07 +0100 Subject: unixfd: Close fd in error path Found by Coverity. Bug-Redhat: https://bugzilla.redhat.com/show_bug.cgi?id=1938703 --- dbus_bindings/unixfd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dbus_bindings/unixfd.c b/dbus_bindings/unixfd.c index f39a0ce..3da9323 100644 --- a/dbus_bindings/unixfd.c +++ b/dbus_bindings/unixfd.c @@ -145,8 +145,10 @@ UnixFd_tp_new(PyTypeObject *cls, PyObject *args, PyObject *kwargs) } self = (UnixFdObject *) cls->tp_alloc(cls, 0); - if (!self) + if (!self) { + close(fd); return NULL; + } self->fd = fd; if (variant_level < 0) { -- cgit v1.2.1