【发布时间】:2021-05-24 11:40:34
【问题描述】:
在我的项目中有一个子功能。在这个函数中,我需要临时存储我的数据。所以我用malloc(),不知道有没有必要用free()?
void *hash2(unsigned char *mes, element_t d)
{
size_t iterations = strlen(mes) / 8;
unsigned char *rtemp = malloc(32 * sizeof(char));
SHA256(mes, iterations, rtemp);
element_from_hash(d, rtemp, 32);
free(rtemp);
}
【问题讨论】:
标签: c malloc dynamic-memory-allocation free