diff --git a/components/net/lwip-2.1/porting/src/api_shell.c b/components/net/lwip-2.1/porting/src/api_shell.c index 1231e637..e513db1c 100644 --- a/components/net/lwip-2.1/porting/src/api_shell.c +++ b/components/net/lwip-2.1/porting/src/api_shell.c @@ -586,7 +586,6 @@ u32_t OsShellPing(int argc, const char **argv) stPingTask.uwArg = (UINTPTR)parg; ret = LOS_TaskCreate((UINT32 *)(&ping_taskid), &stPingTask); if (ret != LOS_OK) { - free(parg); PRINTK("ping_task create failed 0x%08x.\n", ret); count = LWIP_SHELL_CMD_PING_RETRY_TIMES; } else { @@ -602,6 +601,8 @@ u32_t OsShellPing(int argc, const char **argv) PRINTK("Ping cmd failed due some errors\n"); } + free(parg); + return LOS_OK; ping_error: lwip_ping_usage();