Merge branch 'bugfix-memory-leak-by-ret-error' into 'develop-v1.1.0'

TSG-6617: 异常数据包返回-1,导致内存泄漏

See merge request MESA_Platform/gquic!1
This commit is contained in:
刘学利
2021-06-23 06:38:56 +00:00

View File

@@ -515,7 +515,7 @@ enum _QUIC_VERSION is_quic_protocol(struct streaminfo *pstream, struct _quic_con
int parse_extension_tag(struct streaminfo *pstream, struct _quic_stream **quic_stream, void *a_packet, char *payload, int payload_len, int *used_len, int tag_num)
{
int ret=0,tag_used_num=0;
int tag_used_num=0;
int tag_type,skip_tsg=0;
int total_tag_len=0,tag_len=0;
int tag_offset_end=0,pre_tag_offset_end=0;
@@ -606,7 +606,7 @@ int parse_extension_tag(struct streaminfo *pstream, struct _quic_stream **quic_s
*used_len += total_tag_len;
return ret;
return 0;
}
int gquic_frame_type_ack(struct streaminfo *pstream, struct _quic_context* _context, char *payload, int payload_len, int *used_len, char frame_type, void *a_packet)
@@ -662,6 +662,7 @@ int gquic_frame_type_ack(struct streaminfo *pstream, struct _quic_context* _cont
int gquic_frame_type_stream(struct streaminfo *pstream, struct _quic_context* _context, char *payload, int payload_len, int *used_len, char frame_type, void *a_packet)
{
int ret=0;
char state=APP_STATE_GIVEME;
unsigned short tag_num = 0;
unsigned int stream_id, message_tag;
@@ -680,28 +681,28 @@ int gquic_frame_type_stream(struct streaminfo *pstream, struct _quic_context* _c
ret=parse_extension_tag(pstream, &(_context->quic_info.client_hello), a_packet, payload, payload_len, used_len, tag_num);
if(ret>=0 && _context->call_business)
{
ret=quic_callPlugins(pstream, _context, (void *)(_context->quic_info.client_hello), sizeof(void *), QUIC_CLIENT_HELLO_MASK, a_packet);
state=quic_callPlugins(pstream, _context, (void *)(_context->quic_info.client_hello), sizeof(void *), QUIC_CLIENT_HELLO_MASK, a_packet);
}
break;
case SHLO: //MTAG_SHLO;
ret=parse_extension_tag(pstream, &(_context->quic_info.server_hello), a_packet, payload, payload_len, used_len, tag_num);
if(ret>=0 && _context->call_business)
{
ret=quic_callPlugins(pstream, _context, (void *)(_context->quic_info.server_hello), sizeof(void *), QUIC_SERVER_HELLO_MASK, a_packet);
state=quic_callPlugins(pstream, _context, (void *)(_context->quic_info.server_hello), sizeof(void *), QUIC_SERVER_HELLO_MASK, a_packet);
}
break;
case REJ: //MTAG_REJ;
ret=parse_extension_tag(pstream, &(_context->quic_info.rejection), a_packet, payload, payload_len, used_len, tag_num);
if(ret>=0 && _context->call_business)
{
ret=quic_callPlugins(pstream, _context, (void *)(_context->quic_info.rejection), sizeof(void *), QUIC_REJECTION_MASK, a_packet);
state=quic_callPlugins(pstream, _context, (void *)(_context->quic_info.rejection), sizeof(void *), QUIC_REJECTION_MASK, a_packet);
}
break;
default:
break;
}
return ret;
return state;
}
//frame type->stream->offset->data length
@@ -972,7 +973,7 @@ int quic_protocol_identify(struct streaminfo *a_stream, void *a_packet, char *ou
_context=(struct _quic_context *)pme;
ret=quic_process(a_stream, _context, a_stream->threadnum, a_packet);
if(ret!=PROT_STATE_DROPME)
if(ret!=PROT_STATE_DROPME && _context->is_quic!=QUIC_VERSION_UNKNOWN)
{
if(_context->quic_info.client_hello!=NULL)
{