summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTero Roponen <tero.roponen@gmail.com>2013-08-12 19:20:54 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-08-12 13:40:19 -0700
commitec67cb408b0b65aa1cd36fa5f7d4121695804623 (patch)
tree731fb6c20e8148aff2e0533e12b9bab14eeeb758
parent27940fdc7769131c6d18c7fd2d1e8f61cf952fd0 (diff)
downloadkdbus-bus-ec67cb408b0b65aa1cd36fa5f7d4121695804623.tar.gz
kdbus-bus-ec67cb408b0b65aa1cd36fa5f7d4121695804623.tar.bz2
kdbus-bus-ec67cb408b0b65aa1cd36fa5f7d4121695804623.zip
kdbus: fix some memory leaks
These were found by cppcheck. Signed-off-by: Tero Roponen <tero.roponen@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--bus.c3
-rw-r--r--connection.c2
-rw-r--r--endpoint.c1
-rw-r--r--namespace.c1
4 files changed, 5 insertions, 2 deletions
diff --git a/bus.c b/bus.c
index e44e0621f53..88836b715a8 100644
--- a/bus.c
+++ b/bus.c
@@ -290,7 +290,7 @@ int kdbus_bus_make_user(void __user *buf, struct kdbus_cmd_bus_kmake **kmake)
}
if (!KDBUS_IS_ALIGNED8(km->make.bloom_size)) {
- return -EINVAL;
+ ret = -EINVAL;
goto exit;
}
@@ -303,5 +303,6 @@ int kdbus_bus_make_user(void __user *buf, struct kdbus_cmd_bus_kmake **kmake)
return 0;
exit:
+ kfree(km);
return ret;
}
diff --git a/connection.c b/connection.c
index 9412db02de1..10d0caece82 100644
--- a/connection.c
+++ b/connection.c
@@ -161,7 +161,7 @@ static int kdbus_conn_memfd_ref(const struct kdbus_item *item,
/* The specified size in the item cannot be larger than the file. */
if (item->memfd.size > kdbus_memfd_size(fp)) {
- return -EBADF;
+ ret = -EBADF;
goto exit_unref;
}
diff --git a/endpoint.c b/endpoint.c
index ab5f21ea396..477bf88227a 100644
--- a/endpoint.c
+++ b/endpoint.c
@@ -286,5 +286,6 @@ int kdbus_ep_kmake_user(void __user *buf, struct kdbus_cmd_ep_kmake **kmake)
return 0;
exit:
+ kfree(km);
return ret;
}
diff --git a/namespace.c b/namespace.c
index 58836fedea3..1062f3bf507 100644
--- a/namespace.c
+++ b/namespace.c
@@ -306,5 +306,6 @@ int kdbus_ns_kmake_user(void __user *buf, struct kdbus_cmd_ns_kmake **kmake)
return 0;
exit:
+ kfree(km);
return ret;
}