From: Simon Wilkinson Date: Tue, 12 Feb 2013 13:54:18 +0000 (+0000) Subject: ptserver: Use correct structure type in malloc X-Git-Tag: upstream/1.8.0_pre1^2~1510 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=2ee578d80034d8c636ebc1b242942865eb338f4f;p=packages%2Fo%2Fopenafs.git ptserver: Use correct structure type in malloc prentries is a list of 'struct prlistentries' objects, not a list of 'struct prentry'. Use the correct type in our call to malloc. Caught by clang analyzer Change-Id: I6c36e4b875eafb8aff6506cf800d47b45a79825d Reviewed-on: http://gerrit.openafs.org/9150 Reviewed-by: Derrick Brashear Tested-by: BuildBot Reviewed-by: Jeffrey Altman --- diff --git a/src/ptserver/ptprocs.c b/src/ptserver/ptprocs.c index cf31d7697..776a67b4f 100644 --- a/src/ptserver/ptprocs.c +++ b/src/ptserver/ptprocs.c @@ -1479,7 +1479,7 @@ put_prentries(struct prentry *tentry, prentries *bulkentries) if (bulkentries->prentries_val == 0) { bulkentries->prentries_len = 0; bulkentries->prentries_val = malloc(PR_MAXENTRIES * - sizeof(struct prentry)); + sizeof(struct prlistentries)); if (!bulkentries->prentries_val) { return (PRNOMEM); } @@ -1489,7 +1489,7 @@ put_prentries(struct prentry *tentry, prentries *bulkentries) return (-1); } - entry = (struct prlistentries *)bulkentries->prentries_val; + entry = bulkentries->prentries_val; entry += bulkentries->prentries_len; entry->flags = tentry->flags >> PRIVATE_SHIFT;