Clang

Hello everyone!

I’ve found strange code in tools/libclang/CIndex.cpp in function clang_tokenize(). Lines

5570*Tokens = (CXToken *)malloc(sizeof(CXToken) * CXTokens.size());
memmove(*Tokens, CXTokens.data(), sizeof(CXToken) * CXTokens.size());

seem weird without checking the result of malloc-function invocation. Since malloc() can return null pointer, this value can be used in memmove below.

The same case I’ve found in