[PATCH 4/5] totemudpu: Handle fd leak in totemudpu

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Jan Friesse <jfriesse@xxxxxxxxxx>
---
 exec/totemudpu.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/exec/totemudpu.c b/exec/totemudpu.c
index 12ec63c..694ae30 100644
--- a/exec/totemudpu.c
+++ b/exec/totemudpu.c
@@ -1034,7 +1034,7 @@ static int totemudpu_create_sending_socket(
 	if (res == -1) {
 		LOGSYS_PERROR (errno, instance->totemudpu_log_level_warning,
 			"Could not set non-blocking operation on token socket");
-		return (-1);
+		goto error_close_fd;
 	}
 
 	/*
@@ -1047,6 +1047,9 @@ static int totemudpu_create_sending_socket(
 	if (res == -1) {
 		LOGSYS_PERROR (errno, instance->totemudpu_log_level_notice,
 			"Could not set sendbuf size");
+		/*
+		 * Fail in setting sendbuf size is not fatal -> don't exit
+		 */
 	}
 
 	/*
@@ -1057,11 +1060,14 @@ static int totemudpu_create_sending_socket(
 	if (res == -1) {
 		LOGSYS_PERROR (errno, instance->totemudpu_log_level_warning,
 			"bind token socket failed");
-		return (-1);
+		goto error_close_fd;
 	}
 
 	return (fd);
 
+error_close_fd:
+	close(fd);
+	return (-1);
 }
 
 int totemudpu_member_add (
-- 
1.7.1

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss




[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux