Skip redundant memset(p, 0, 0) calls where p is not valid for writing.
Context: See second section of #15950 (comment)
Nothing urgent obviously and perhaps not even an issue (the spec is a bit unclear) but would be nice to err on the side of caution in unclear cases like this :-)