From: Simon Wilkinson Date: Wed, 3 Apr 2013 11:09:03 +0000 (-0400) Subject: fix garbage counters in supergroup prdb_check X-Git-Tag: upstream/1.6.3^2~36 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=65ae1315891e4c4802b82bdeceea40d20865a648;p=packages%2Fo%2Fopenafs.git fix garbage counters in supergroup prdb_check This is a backport of one hunk of commit 9efc255ab8de7ad90c7d599fea7bd1956bfd48c2, where a calloc fixes an incorrectly sized memset. The original memset clears the size of the pointer, not the sizeof the structure. Change-Id: I40250e0346345fe9b4b43d14e76ea5fb23c8c04b Reviewed-on: http://gerrit.openafs.org/9701 Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Stephan Wiesand --- diff --git a/src/ptserver/db_verify.c b/src/ptserver/db_verify.c index 0e7676533..a07d04ea4 100644 --- a/src/ptserver/db_verify.c +++ b/src/ptserver/db_verify.c @@ -1486,12 +1486,11 @@ inccount(struct idused **idmapp, int id) idmapp = &idmap->idnext; } if (!idmap) { - idmap = (struct idused *)malloc(sizeof *idmap); + idmap = calloc(1, sizeof *idmap); if (!idmap) { perror("idmap"); exit(1); } - memset(idmap, 0, sizeof idmap); idmap->idstart = id & ~(IDCOUNT - 1); idmap->idnext = *idmapp; *idmapp = idmap;