提交 6dd4a543 编写于 作者: wafwerar's avatar wafwerar

fix(shell): memory free error.

上级 cdbfe53c
...@@ -68,6 +68,7 @@ static void dmSetSignalHandle() { ...@@ -68,6 +68,7 @@ static void dmSetSignalHandle() {
static int32_t dmParseArgs(int32_t argc, char const *argv[]) { static int32_t dmParseArgs(int32_t argc, char const *argv[]) {
int32_t cmdEnvIndex = 0; int32_t cmdEnvIndex = 0;
if (argc < 2) return 0;
global.envCmd = taosMemoryMalloc(argc-1); global.envCmd = taosMemoryMalloc(argc-1);
memset(global.envCmd, 0, argc-1); memset(global.envCmd, 0, argc-1);
for (int32_t i = 1; i < argc; ++i) { for (int32_t i = 1; i < argc; ++i) {
......
...@@ -82,6 +82,8 @@ int32_t taosBackTrace(void **buffer, int32_t size) { ...@@ -82,6 +82,8 @@ int32_t taosBackTrace(void **buffer, int32_t size) {
#endif #endif
void *taosMemoryMalloc(int32_t size) { void *taosMemoryMalloc(int32_t size) {
if (size == 0) return NULL;
#ifdef USE_TD_MEMORY #ifdef USE_TD_MEMORY
void *tmp = malloc(size + sizeof(TdMemoryInfo)); void *tmp = malloc(size + sizeof(TdMemoryInfo));
if (tmp == NULL) return NULL; if (tmp == NULL) return NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册