summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2008-10-02 15:24:15 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2008-10-02 15:24:15 +0000
commit100dd5c229f194af04fee57a140c1e460358a8b8 (patch)
treef608442ab7f91215286d86528fc907255bab23a6
parent4ec929b743ce1b5f9cdae8958624a9e24da32837 (diff)
use calloc() instead of malloc() and bzero()
-rw-r--r--usr.sbin/ypldap/aldap.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/usr.sbin/ypldap/aldap.c b/usr.sbin/ypldap/aldap.c
index e78c693ae94..b650a865c07 100644
--- a/usr.sbin/ypldap/aldap.c
+++ b/usr.sbin/ypldap/aldap.c
@@ -1,5 +1,5 @@
-/* $Id: aldap.c,v 1.2 2008/09/30 17:31:04 pyr Exp $ */
-/* $OpenBSD: aldap.c,v 1.2 2008/09/30 17:31:04 pyr Exp $ */
+/* $Id: aldap.c,v 1.3 2008/10/02 15:24:14 deraadt Exp $ */
+/* $OpenBSD: aldap.c,v 1.3 2008/10/02 15:24:14 deraadt Exp $ */
/*
* Copyright (c) 2008 Alexander Schrijver <aschrijver@openbsd.org>
@@ -51,9 +51,8 @@ aldap_init(int fd)
{
struct aldap *a;
- if((a = malloc(sizeof(*a))) == NULL)
+ if((a = calloc(1, sizeof(*a))) == NULL)
return NULL;
- bzero(a, sizeof(*a));
a->ber.fd = fd;
return a;
@@ -130,9 +129,8 @@ aldap_parse(struct aldap *ldap)
struct aldap_message *m;
struct ber_element *a = NULL;
- if((m = malloc(sizeof(struct aldap_message))) == NULL)
+ if((m = calloc(1, sizeof(struct aldap_message))) == NULL)
return NULL;
- bzero(m, sizeof(struct aldap_message));
if((m->msg = ber_read_elements(&ldap->ber, NULL)) == NULL)
return NULL;