The problem in that case is not a miscast malloc (for indeed the cast could be absolutely correct, technically speaking), but the fact that the cast would then hide a likely warning that would alert...