bugfix:修复packet io内存泄漏

This commit is contained in:
wangmenglan
2023-05-22 15:19:29 +08:00
parent b931a3dc58
commit fc2625c691
6 changed files with 88 additions and 35 deletions

View File

@@ -297,6 +297,8 @@ int ctrl_packet_parser_parse(void *ctx, const char* data, size_t length, void *l
goto error;
}
handler->cmsg = tfe_cmsg_init();
tfe_cmsg_dup(handler->cmsg);
proxy_map = mpack_node_map_cstr(params, "proxy");
ret = proxy_parse_messagepack(proxy_map, handler, logger);
if (ret != 0)
@@ -307,6 +309,8 @@ succ:
return 0;
error:
mpack_tree_destroy(&tree);
tfe_cmsg_destroy(handler->cmsg);
tfe_cmsg_destroy(handler->cmsg);
return -1;
}
@@ -330,8 +334,14 @@ const char *session_state_to_string(enum session_state state)
void ctrl_packet_parser_init(struct ctrl_pkt_parser *handler)
{
memset(handler, 0, sizeof(struct ctrl_pkt_parser));
handler->cmsg = tfe_cmsg_init();
tfe_cmsg_dup(handler->cmsg);
}
void ctrl_packet_cmsg_destroy(struct ctrl_pkt_parser *handler)
{
if (handler) {
tfe_cmsg_destroy(handler->cmsg);
tfe_cmsg_destroy(handler->cmsg);
}
}
void ctrl_packet_parser_dump(struct ctrl_pkt_parser *handler, void *logger)