From 1620b6932913d2b2dba7baf13dcb92b7ee7fba91 Mon Sep 17 00:00:00 2001 From: wangmenglan Date: Tue, 12 Nov 2024 15:19:14 +0800 Subject: [PATCH] bugfix: memory leak --- common/src/tfe_ctrl_packet.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/src/tfe_ctrl_packet.cpp b/common/src/tfe_ctrl_packet.cpp index 44dd337..94f4ba5 100644 --- a/common/src/tfe_ctrl_packet.cpp +++ b/common/src/tfe_ctrl_packet.cpp @@ -190,11 +190,14 @@ static int tags_ids_array_parse_mpack(struct ctrl_pkt_parser *handler, mpack_nod if (mpack_parse_uuid(mpack_node_array_at(node, i), tags_ids[i]) != 0) { TFE_LOG_ERROR(g_packet_io_logger, "%s: session %lu unexpected control packet: (%s[%d] len != uuid_t[%d])", LOG_TAG_CTRLPKT, handler->session_id, tags_ids_cmsg_name_maps[map_index], i, UUID_LEN); - return -1; + goto end; } } tfe_cmsg_set(handler->cmsg, (enum tfe_cmsg_tlv_type)tags_ids_cmsg_maps[map_index], (const unsigned char*)tags_ids, tags_ids_len); +end: + if (tags_ids) + free(tags_ids); return 0; }