Close #77 修正http_half_private结构体未完全释放的问题
This commit is contained in:
@@ -27,6 +27,7 @@ void hf_content_uncompress_destroy(struct hf_content_uncompress * cv_object)
|
||||
{
|
||||
(void) inflateEnd(cv_object->z_stream_ptr);
|
||||
free(cv_object->z_stream_ptr);
|
||||
free(cv_object->chunk);
|
||||
cv_object->z_stream_ptr = NULL;
|
||||
free(cv_object);
|
||||
}
|
||||
@@ -196,5 +197,8 @@ int hf_content_compress_write(struct hf_content_compress * cv_object,
|
||||
|
||||
void hf_content_compress_destroy(hf_content_compress * cv_object)
|
||||
{
|
||||
return;
|
||||
(void) deflateEnd(cv_object->z_stream_ptr);
|
||||
free(cv_object->z_stream_ptr);
|
||||
cv_object->z_stream_ptr = NULL;
|
||||
free(cv_object);
|
||||
}
|
||||
|
||||
@@ -693,6 +693,18 @@ void hf_private_destory(struct http_half_private * hf_private)
|
||||
if (hf_private->parse_object != NULL)
|
||||
{
|
||||
free(hf_private->parse_object);
|
||||
hf_private->parse_object = NULL;
|
||||
}
|
||||
|
||||
struct http_header_private * header_iter = NULL;
|
||||
struct http_header_private * header_titer = NULL;
|
||||
|
||||
TAILQ_FOREACH_SAFE(header_iter, &hf_private->header_list, next, header_titer)
|
||||
{
|
||||
TAILQ_REMOVE(&hf_private->header_list, header_iter, next);
|
||||
free(header_iter->field);
|
||||
free(header_iter->value);
|
||||
free(header_iter);
|
||||
}
|
||||
|
||||
if (hf_private->event_cb_user_deleter != NULL)
|
||||
@@ -700,6 +712,54 @@ void hf_private_destory(struct http_half_private * hf_private)
|
||||
hf_private->event_cb_user_deleter(hf_private->event_cb_user);
|
||||
}
|
||||
|
||||
if (hf_private->evbuf_uri != NULL)
|
||||
{
|
||||
evbuffer_free(hf_private->evbuf_uri);
|
||||
hf_private->evbuf_uri = NULL;
|
||||
}
|
||||
|
||||
if (hf_private->url_storage)
|
||||
{
|
||||
free(hf_private->url_storage);
|
||||
hf_private->url_storage = NULL;
|
||||
}
|
||||
|
||||
if (hf_private->cv_uncompress_object)
|
||||
{
|
||||
hf_content_uncompress_destroy(hf_private->cv_uncompress_object);
|
||||
hf_private->cv_uncompress_object = NULL;
|
||||
}
|
||||
|
||||
if (hf_private->cv_compress_object)
|
||||
{
|
||||
hf_content_compress_destroy(hf_private->cv_compress_object);
|
||||
hf_private->cv_compress_object = NULL;
|
||||
}
|
||||
|
||||
if (hf_private->evbuf_header_field)
|
||||
{
|
||||
evbuffer_free(hf_private->evbuf_header_field);
|
||||
hf_private->evbuf_header_field = NULL;
|
||||
}
|
||||
|
||||
if (hf_private->evbuf_header_value)
|
||||
{
|
||||
evbuffer_free(hf_private->evbuf_header_value);
|
||||
hf_private->evbuf_header_value = NULL;
|
||||
}
|
||||
|
||||
if (hf_private->evbuf_body)
|
||||
{
|
||||
evbuffer_free(hf_private->evbuf_body);
|
||||
hf_private->evbuf_body = NULL;
|
||||
}
|
||||
|
||||
if (hf_private->evbuf_raw)
|
||||
{
|
||||
evbuffer_free(hf_private->evbuf_raw);
|
||||
hf_private->evbuf_raw = NULL;
|
||||
}
|
||||
|
||||
free(hf_private);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user