Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/ypserv/ypserv Replace malloc + incorrect memset wit...
details: https://anonhg.NetBSD.org/src/rev/37d449c8426b
branches: trunk
changeset: 766741:37d449c8426b
user: joerg <joerg%NetBSD.org@localhost>
date: Fri Jul 01 03:09:29 2011 +0000
description:
Replace malloc + incorrect memset with calloc.
diffstat:
usr.sbin/ypserv/ypserv/ypserv_proc.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diffs (34 lines):
diff -r 56661ed705e6 -r 37d449c8426b usr.sbin/ypserv/ypserv/ypserv_proc.c
--- a/usr.sbin/ypserv/ypserv/ypserv_proc.c Fri Jul 01 03:07:21 2011 +0000
+++ b/usr.sbin/ypserv/ypserv/ypserv_proc.c Fri Jul 01 03:09:29 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ypserv_proc.c,v 1.14 2009/10/20 00:51:15 snj Exp $ */
+/* $NetBSD: ypserv_proc.c,v 1.15 2011/07/01 03:09:29 joerg Exp $ */
/*
* Copyright (c) 1994 Mats O Jansson <moj%stacken.kth.se@localhost>
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: ypserv_proc.c,v 1.14 2009/10/20 00:51:15 snj Exp $");
+__RCSID("$NetBSD: ypserv_proc.c,v 1.15 2011/07/01 03:09:29 joerg Exp $");
#endif
#include <sys/stat.h>
@@ -476,14 +476,12 @@
suffix = (char *)&dp->d_name[dp->d_namlen - 3];
if (strcmp(suffix, ".db") == 0) {
/* Found one. */
- m = (struct ypmaplist *)
- malloc(sizeof(struct ypmaplist));
+ m = calloc(1, sizeof(struct ypmaplist));
if (m == NULL) {
status = YP_YPERR;
goto out;
}
- (void)memset(m, 0, sizeof(m));
(void)strlcpy(m->ypml_name, dp->d_name,
(size_t)(dp->d_namlen - 2));
m->ypml_next = res.list;
Home |
Main Index |
Thread Index |
Old Index