|
From: Rainer W. <rwe...@mo...> - 2013-11-06 11:47:15
|
Alexander Sbitnev <ale...@gm...> writes:
> Sorry if I it was fixed long ago.
> Got error during compilation on latest Ubuntu:
>
> ipsec_doi.c: In function ‘get_proppair_and_doi_sit’:
> ipsec_doi.c:1186:24: error: argument to ‘sizeof’ in ‘memset’ call is the
> same expression as the destination; did you mean to dereference it?
> [-Werror=sizeof-pointer-memaccess]
>
> Since "pair" defined as "struct prop_pair **pair", I suppose the line in
> question should be:
> memset(pair, 0, sizeof(*pair));
> instead of:
> memset(pair, 0, sizeof(pair));
That's something which already showed up here a while ago. The complete
code block is
pair = racoon_calloc(1, MAXPROPPAIRLEN * sizeof(*pair));
if (pair == NULL) {
plog(LLV_ERROR, LOCATION, NULL,
"failed to get buffer.\n");
goto bad;
}
memset(pair, 0, sizeof(pair));
pair is a struct proppair **. This means the memset is technically
correct because sizeof(pair) == sizeof(*pair). But considering that the
allocated memory was already zeroed by racoon_calloc, zeroeing it again
doesn't accomplish anything useful and the statement can be deleted.
|