diff options
Diffstat (limited to 'udev/lib')
-rw-r--r-- | udev/lib/libudev-ctrl.c | 6 | ||||
-rw-r--r-- | udev/lib/libudev-device.c | 3 | ||||
-rw-r--r-- | udev/lib/libudev-enumerate.c | 3 | ||||
-rw-r--r-- | udev/lib/libudev-monitor.c | 6 | ||||
-rw-r--r-- | udev/lib/libudev-queue.c | 3 | ||||
-rw-r--r-- | udev/lib/libudev.c | 3 |
6 files changed, 8 insertions, 16 deletions
diff --git a/udev/lib/libudev-ctrl.c b/udev/lib/libudev-ctrl.c index 848f507878..2e15db0be0 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; diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index b54c7271e7..e4cbd8e689 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -236,10 +236,9 @@ struct udev_device *device_new(struct udev *udev) if (udev == NULL) return NULL; - udev_device = malloc(sizeof(struct udev_device)); + udev_device = calloc(1, sizeof(struct udev_device)); if (udev_device == NULL) return NULL; - memset(udev_device, 0x00, sizeof(struct udev_device)); udev_device->refcount = 1; udev_device->udev = udev; udev_list_init(&udev_device->devlinks_list); diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index b35a82d0ce..e5a4ccee3b 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -53,10 +53,9 @@ struct udev_enumerate *udev_enumerate_new(struct udev *udev) { struct udev_enumerate *udev_enumerate; - udev_enumerate = malloc(sizeof(struct udev_enumerate)); + udev_enumerate = calloc(1, sizeof(struct udev_enumerate)); if (udev_enumerate == NULL) return NULL; - memset(udev_enumerate, 0x00, (sizeof(struct udev_enumerate))); udev_enumerate->refcount = 1; udev_enumerate->udev = udev; udev_list_init(&udev_enumerate->devices_list); diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index 6c6f4aa7e0..7f7f8460c2 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -67,10 +67,9 @@ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char return NULL; if (socket_path == NULL) return NULL; - udev_monitor = malloc(sizeof(struct udev_monitor)); + udev_monitor = calloc(1, sizeof(struct udev_monitor)); if (udev_monitor == NULL) return NULL; - memset(udev_monitor, 0x00, sizeof(struct udev_monitor)); udev_monitor->refcount = 1; udev_monitor->udev = udev; @@ -105,10 +104,9 @@ struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev) if (udev == NULL) return NULL; - udev_monitor = malloc(sizeof(struct udev_monitor)); + udev_monitor = calloc(1, sizeof(struct udev_monitor)); if (udev_monitor == NULL) return NULL; - memset(udev_monitor, 0x00, sizeof(struct udev_monitor)); udev_monitor->refcount = 1; udev_monitor->udev = udev; diff --git a/udev/lib/libudev-queue.c b/udev/lib/libudev-queue.c index f1c69fdb93..ea75f22044 100644 --- a/udev/lib/libudev-queue.c +++ b/udev/lib/libudev-queue.c @@ -45,10 +45,9 @@ struct udev_queue *udev_queue_new(struct udev *udev) if (udev == NULL) return NULL; - udev_queue = malloc(sizeof(struct udev_queue)); + udev_queue = calloc(1, sizeof(struct udev_queue)); if (udev_queue == NULL) return NULL; - memset(udev_queue, 0x00, sizeof(struct udev_queue)); udev_queue->refcount = 1; udev_queue->udev = udev; udev_list_init(&udev_queue->queue_list); diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c index a09aa051b3..fcb784580b 100644 --- a/udev/lib/libudev.c +++ b/udev/lib/libudev.c @@ -96,10 +96,9 @@ struct udev *udev_new(void) char *config_file; FILE *f; - udev = malloc(sizeof(struct udev)); + udev = calloc(1, sizeof(struct udev)); if (udev == NULL) return NULL; - memset(udev, 0x00, (sizeof(struct udev))); udev->refcount = 1; udev->log_fn = log_stderr; udev->log_priority = LOG_ERR; |