summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid King <dking@redhat.com>2021-05-20 10:06:07 +0100
committerSimon McVittie <smcv@collabora.com>2021-07-19 13:59:44 +0000
commite4e401127bbd323b220ca07aa08eafd0fb4c0270 (patch)
tree1ddf3258c82818405631eb28b9fec85acd9ac339
parent051022c1c51e917c43be90ed9d70296a2e4576ae (diff)
downloaddbus-python-e4e401127bbd323b220ca07aa08eafd0fb4c0270.tar.gz
unixfd: Close fd in error path
Found by Coverity. Bug-Redhat: https://bugzilla.redhat.com/show_bug.cgi?id=1938703
-rw-r--r--dbus_bindings/unixfd.c4
1 files changed, 3 insertions, 1 deletions
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) {