[systemd-devel] [PATCH 1/2] endpoint: free the policy_db on error path

Djalal Harouni tixxdz at opendz.org
Sun Mar 23 15:06:35 PDT 2014


Signed-off-by: Djalal Harouni <tixxdz at opendz.org>
---
 endpoint.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/endpoint.c b/endpoint.c
index 465ae31..5afabf9 100644
--- a/endpoint.c
+++ b/endpoint.c
@@ -236,7 +236,7 @@ int kdbus_ep_new(struct kdbus_bus *bus, const char *name,
 	if (bus->disconnected) {
 		mutex_unlock(&bus->lock);
 		ret = -ESHUTDOWN;
-		goto exit_dev_unregister;
+		goto exit_policy_db_free;
 	}
 	e->id = ++bus->ep_seq_last;
 	e->bus = kdbus_bus_ref(bus);
@@ -247,6 +247,9 @@ int kdbus_ep_new(struct kdbus_bus *bus, const char *name,
 		*ep = e;
 	return 0;
 
+exit_policy_db_free:
+	if (policy)
+		kdbus_policy_db_free(e->policy_db);
 exit_dev_unregister:
 	device_unregister(e->dev);
 exit_idr:
-- 
1.8.5.3



More information about the systemd-devel mailing list