From 34afb3e6b903fc1659b1c869fa2fb4226038e076 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Fri, 30 Mar 2012 19:16:50 +0100 Subject: [PATCH] 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 Change-Id: Ia6c566534efae2f67f1b9bd22198d352238a987c Reviewed-on: http://gerrit.openafs.org/7076 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/libadmin/vos/afs_vosAdmin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libadmin/vos/afs_vosAdmin.c b/src/libadmin/vos/afs_vosAdmin.c index 934e5eb..80846fd 100644 --- a/src/libadmin/vos/afs_vosAdmin.c +++ b/src/libadmin/vos/afs_vosAdmin.c @@ -3496,7 +3496,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: -- 1.9.4