X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=udev%2Flib%2Flibudev-ctrl.c;h=caf0dc08a363e29bf415954adaf0838b6f526726;hb=1028fe14b65d861415cda99c4ff7d0bafd67bb7f;hp=848f5078783db4a2a4080df73b7eb08083c9d3b0;hpb=b692a750899453e45faa07c057020a22594eb521;p=elogind.git diff --git a/udev/lib/libudev-ctrl.c b/udev/lib/libudev-ctrl.c index 848f50787..caf0dc08a 100644 --- a/udev/lib/libudev-ctrl.c +++ b/udev/lib/libudev-ctrl.c @@ -72,10 +72,9 @@ struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socke { struct udev_ctrl *uctrl; - uctrl = malloc(sizeof(struct udev_ctrl)); + uctrl = calloc(1, sizeof(struct udev_ctrl)); if (uctrl == NULL) return NULL; - memset(uctrl, 0x00, sizeof(struct udev_ctrl)); uctrl->refcount = 1; uctrl->udev = udev; @@ -213,10 +212,9 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl) struct ucred *cred; char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; - uctrl_msg = malloc(sizeof(struct udev_ctrl_msg)); + uctrl_msg = calloc(1, sizeof(struct udev_ctrl_msg)); if (uctrl_msg == NULL) return NULL; - memset(uctrl_msg, 0x00, sizeof(struct udev_ctrl_msg)); uctrl_msg->refcount = 1; uctrl_msg->uctrl = uctrl; @@ -252,7 +250,7 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl) goto err; } - info(uctrl->udev, "created ctrl_msg %p (%i)\n", uctrl_msg, uctrl_msg->ctrl_msg_wire.type); + dbg(uctrl->udev, "created ctrl_msg %p (%i)\n", uctrl_msg, uctrl_msg->ctrl_msg_wire.type); return uctrl_msg; err: udev_ctrl_msg_unref(uctrl_msg); @@ -274,7 +272,7 @@ void udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg) ctrl_msg->refcount--; if (ctrl_msg->refcount > 0) return; - info(ctrl_msg->uctrl->udev, "release ctrl_msg %p\n", ctrl_msg); + dbg(ctrl_msg->uctrl->udev, "release ctrl_msg %p\n", ctrl_msg); free(ctrl_msg); }