Fix: consumer double-close on error
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 27 Jun 2013 21:32:37 +0000 (17:32 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Fri, 28 Jun 2013 14:57:53 +0000 (10:57 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
src/common/consumer.c

index 540c59f40d2f58d18d53586ed3eaf14a39e8300e..1dcc52c6a648f2d15f8f48b53b27e3fbcf67769a 100644 (file)
@@ -3168,6 +3168,7 @@ int consumer_add_relayd_socket(int net_seq_idx, int sock_type,
 
                /* Assign new file descriptor */
                relayd->control_sock.sock.fd = fd;
+               fd = -1;        /* For error path */
                /* Assign version values. */
                relayd->control_sock.major = relayd_sock->major;
                relayd->control_sock.minor = relayd_sock->minor;
@@ -3213,6 +3214,7 @@ int consumer_add_relayd_socket(int net_seq_idx, int sock_type,
 
                /* Assign new file descriptor */
                relayd->data_sock.sock.fd = fd;
+               fd = -1;        /* for eventual error paths */
                /* Assign version values. */
                relayd->data_sock.major = relayd_sock->major;
                relayd->data_sock.minor = relayd_sock->minor;
This page took 0.028622 seconds and 4 git commands to generate.