summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2011-04-13 18:21:47 +0200
committerKay Sievers <kay.sievers@vrfy.org>2011-04-13 18:21:47 +0200
commit80707e9ad67068cd6f6407b64b16482e478cf567 (patch)
treee1542e3cf6aef2ebc1c101432cc2b7b72f390a4a
parent2903820a62de1085f6b5def0fb622070805dd90b (diff)
libudev: ctrl - fix refcounting in connection handling
-rw-r--r--libudev/libudev-ctrl.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/libudev/libudev-ctrl.c b/libudev/libudev-ctrl.c
index cea1b7f55b..2d2dd3a0be 100644
--- a/libudev/libudev-ctrl.c
+++ b/libudev/libudev-ctrl.c
@@ -327,16 +327,15 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn)
return NULL;
uctrl_msg->refcount = 1;
uctrl_msg->conn = conn;
+ udev_ctrl_connection_ref(conn);
iov.iov_base = &uctrl_msg->ctrl_msg_wire;
iov.iov_len = sizeof(struct udev_ctrl_msg_wire);
-
memset(&smsg, 0x00, sizeof(struct msghdr));
smsg.msg_iov = &iov;
smsg.msg_iovlen = 1;
smsg.msg_control = cred_msg;
smsg.msg_controllen = sizeof(cred_msg);
-
size = recvmsg(conn->sock, &smsg, 0);
if (size < 0) {
err(udev, "unable to receive user udevd message: %m\n");
@@ -361,7 +360,6 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn)
}
dbg(udev, "created ctrl_msg %p (%i)\n", uctrl_msg, uctrl_msg->ctrl_msg_wire.type);
- udev_ctrl_connection_ref(conn);
return uctrl_msg;
err:
udev_ctrl_msg_unref(uctrl_msg);