summaryrefslogtreecommitdiff
path: root/udev/lib/libudev.c
diff options
context:
space:
mode:
authorAlan Jenkins <alan-jenkins@tuffmail.co.uk>2008-10-21 11:10:32 +0100
committerKay Sievers <kay.sievers@vrfy.org>2008-10-21 12:54:57 +0200
commitb29a5e4ab98f460d2f79a11d1969858640e897e6 (patch)
treea89a0b059e5b7c365648756ffc76467562030b71 /udev/lib/libudev.c
parenta8a8930072c78013bfa4064067242e4826ef837a (diff)
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 <alan-jenkins@tuffmail.co.uk>
Diffstat (limited to 'udev/lib/libudev.c')
-rw-r--r--udev/lib/libudev.c3
1 files changed, 1 insertions, 2 deletions
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;