修复残留数据,造成select_padding函数段错误

This commit is contained in:
fengweihao
2019-07-31 13:45:08 +08:00
parent 92e8759bad
commit aa88471f25
2 changed files with 29 additions and 35 deletions

View File

@@ -372,38 +372,33 @@ int deflate_write(struct z_stream_st **strm, const uint8_t *source,
void inflate_finished(struct z_stream_st **strm)
{
if (*strm != NULL){
if ((*strm)->brdec_state){
if ((*strm)->brdec_state)
{
BrotliDecoderDestroyInstance((*strm)->brdec_state);
(*strm)->brdec_state = NULL;
return;
(*strm)->brdec_state = NULL;
goto finish;
}
(void)inflateEnd(&((*strm)->zst));
finish:
free(*strm);
*strm = NULL;
}
}
void deflate_finished(struct z_stream_st **strm)
{
if (*strm != NULL){
if (*strm != NULL)
{
if ((*strm)->brenc_state)
{
BrotliEncoderDestroyInstance((*strm)->brenc_state);
(*strm)->brenc_state = NULL;
goto finish;
}
(void) deflateEnd(&((*strm)->zst));
finish:
free(*strm);
*strm = NULL;
}
}
void frame_display(const uint8_t *payload, uint16_t payload_len)
{
int i = 0;
printf("context:(%d)\n", payload_len);
for(i=0; i < (int)payload_len; ++i){
printf(" 0x%02x,", payload[i]);
if( (i + 1) % 16 == 0)
printf("\n");
if ( i > 500)
break;
}
printf("\n\n");
}