fix(shell): memory free error.

This commit is contained in:
afwerar 2022-04-26 16:23:51 +08:00
parent cdbfe53c13
commit 6dd4a54339
2 changed files with 3 additions and 0 deletions

View File

@ -68,6 +68,7 @@ static void dmSetSignalHandle() {
static int32_t dmParseArgs(int32_t argc, char const *argv[]) {
int32_t cmdEnvIndex = 0;
if (argc < 2) return 0;
global.envCmd = taosMemoryMalloc(argc-1);
memset(global.envCmd, 0, argc-1);
for (int32_t i = 1; i < argc; ++i) {

View File

@ -82,6 +82,8 @@ int32_t taosBackTrace(void **buffer, int32_t size) {
#endif
void *taosMemoryMalloc(int32_t size) {
if (size == 0) return NULL;
#ifdef USE_TD_MEMORY
void *tmp = malloc(size + sizeof(TdMemoryInfo));
if (tmp == NULL) return NULL;