From: Simon Wilkinson Date: Fri, 30 Mar 2012 18:16:50 +0000 (+0100) Subject: libadmin: Clear structures according to their size. X-Git-Tag: upstream/1.6.6_pre2^2~60 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=47fb5837820e0dcf46c0c19a15b81848e75be3aa;p=packages%2Fo%2Fopenafs.git libadmin: Clear structures according to their size. memset(a, 0, sizeof(a)) is rarely correct, unless a is an error. Use the size of the destination structure, rather than the size of a pointer to it when deciding how much memory to clear. Caught by clang's new error messages Reviewed-on: http://gerrit.openafs.org/7076 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear (cherry picked from commit 34afb3e6b903fc1659b1c869fa2fb4226038e076) Change-Id: I06912a70af9f3cd54f4a5368e996a7308e687c20 Reviewed-on: http://gerrit.openafs.org/10243 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Mark Vitale Reviewed-by: Stephan Wiesand --- diff --git a/src/libadmin/vos/afs_vosAdmin.c b/src/libadmin/vos/afs_vosAdmin.c index 880eef63f..d24dca466 100644 --- a/src/libadmin/vos/afs_vosAdmin.c +++ b/src/libadmin/vos/afs_vosAdmin.c @@ -3506,7 +3506,7 @@ copyvolintXInfo(struct volintXInfo *source, vos_volumeEntry_p dest, * user from seeing stale data from a previous call */ - memset(dest, 0, sizeof(dest)); + memset(dest, 0, sizeof(*dest)); switch (source->status) { case VOK: