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

@@ -46,9 +46,9 @@ struct tfe_cmsg* tfe_cmsg_init()
pthread_rwlock_init(&(cmsg->rwlock), NULL);
ATOMIC_ZERO(&cmsg->flag);
ATOMIC_ZERO(&cmsg->ref);
ATOMIC_INC(&cmsg->ref);
ATOMIC_ZERO(&(cmsg->flag));
ATOMIC_ZERO(&(cmsg->ref));
ATOMIC_INC(&(cmsg->ref));
return cmsg;
}
@@ -261,6 +261,9 @@ int tfe_cmsg_deserialize(const unsigned char *data, uint16_t len, struct tfe_cms
cmsg = ALLOC(struct tfe_cmsg, 1);
pthread_rwlock_init(&(cmsg->rwlock), NULL);
ATOMIC_ZERO(&(cmsg->flag));
ATOMIC_ZERO(&(cmsg->ref));
ATOMIC_INC(&(cmsg->ref));
offset = sizeof(struct tfe_cmsg_serialize_header);
nr_tlvs = ntohs(header->nr_tlvs);
for(int i = 0; i < nr_tlvs; i++)