From b29a5e4ab98f460d2f79a11d1969858640e897e6 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Tue, 21 Oct 2008 11:10:32 +0100 Subject: use more appropriate alternatives to malloc() Use calloc to request cleared memory instead. Kernel and libc conspire to make this more efficient. Also, replace one malloc() + strcpy() with strdup(). Signed-off-by: Alan Jenkins --- udev/lib/libudev-queue.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'udev/lib/libudev-queue.c') 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); -- cgit v1.2.3-54-g00ecf