Fix memory leak in log collection.

This commit is contained in:
Ghislain MARY 2016-03-10 16:26:54 +01:00
parent 08beaa9b17
commit f7ae768d3e
2 changed files with 3 additions and 1 deletions

View file

@ -531,6 +531,7 @@ static void process_response_from_post_file_log_collection(void *data, const bel
cbs.process_io_error = process_io_error_upload_log_collection;
cbs.process_auth_requested = process_auth_requested_upload_log_collection;
l = belle_http_request_listener_create_from_callbacks(&cbs, core);
belle_sip_object_data_set(BELLE_SIP_OBJECT(req), "http_request_listener", l, belle_sip_object_unref); // Ensure the listener object is destroyed when the request is destroyed
belle_http_provider_send_request(core->http_provider, req, l);
}
if (code == 200) { /* The file has been uploaded correctly, get the server reply */
@ -683,6 +684,7 @@ void linphone_core_upload_log_collection(LinphoneCore *core) {
cbs.process_io_error = process_io_error_upload_log_collection;
cbs.process_auth_requested = process_auth_requested_upload_log_collection;
l = belle_http_request_listener_create_from_callbacks(&cbs, core);
belle_sip_object_data_set(BELLE_SIP_OBJECT(req), "http_request_listener", l, belle_sip_object_unref); // Ensure the listener object is destroyed when the request is destroyed
belle_http_provider_send_request(core->http_provider, req, l);
ms_free(name);
} else {

View file

@ -321,7 +321,7 @@ test_t log_collection_tests[] = {
TEST_NO_TAG("Collect files filled when enabled", collect_files_filled),
TEST_NO_TAG("Logs collected into small file", collect_files_small_size),
TEST_NO_TAG("Logs collected when decreasing max size", collect_files_changing_size),
TEST_ONE_TAG("Upload collected traces", upload_collected_traces, "MemoryLeaks")
TEST_NO_TAG("Upload collected traces", upload_collected_traces)
};
test_suite_t log_collection_test_suite = {"LogCollection", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each,