[systemd-devel] [PATCH] handle: unref handle->ep and free handle->meta on error path

Djalal Harouni tixxdz at opendz.org
Sun Mar 23 16:20:36 PDT 2014


Signed-off-by: Djalal Harouni <tixxdz at opendz.org>
---
 handle.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/handle.c b/handle.c
index 921faca..3af6119 100644
--- a/handle.c
+++ b/handle.c
@@ -130,7 +130,7 @@ static int kdbus_handle_open(struct inode *inode, struct file *file)
 	/* cache the metadata/credentials of the creator of the connection */
 	ret = kdbus_meta_new(&handle->meta);
 	if (ret < 0)
-		goto exit_unlock;
+		goto exit_ep_unref;
 
 	ret = kdbus_meta_append(handle->meta, NULL, 0,
 				KDBUS_ATTACH_CREDS |
@@ -142,11 +142,15 @@ static int kdbus_handle_open(struct inode *inode, struct file *file)
 				KDBUS_ATTACH_SECLABEL |
 				KDBUS_ATTACH_AUDIT);
 	if (ret < 0)
-		goto exit_unlock;
+		goto exit_meta_free;
 
 	mutex_unlock(&handle->domain->lock);
 	return 0;
 
+exit_meta_free:
+	kdbus_meta_free(handle->meta);
+exit_ep_unref:
+	kdbus_ep_unref(handle->ep);
 exit_unlock:
 	mutex_unlock(&handle->domain->lock);
 	kdbus_domain_unref(handle->domain);
-- 
1.8.5.3



More information about the systemd-devel mailing list