未验证 提交 22f9f4b0 编写于 作者: U universeroc 提交者: GitHub

Check memory allocation after malloc

上级 d0e5e817
......@@ -54,9 +54,12 @@ char *taosAddIntHash(void *handle, int32_t key, char *pData) {
hash = (*pObj->hashFp)(pObj, key);
pNode = (IHashNode *)malloc(sizeof(IHashNode) + (size_t)pObj->dataSize);
if (pNode == NULL)
return NULL;
pthread_mutex_lock(&pObj->mutex);
pNode = (IHashNode *)malloc(sizeof(IHashNode) + (size_t)pObj->dataSize);
pNode->key = key;
if (pData != NULL) {
memcpy(pNode->data, pData, (size_t)pObj->dataSize);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册