From 3efa134bedae08d0c03c78c90b99a7a9ef1c3e13 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 18 Dec 2015 16:41:35 +0100 Subject: [PATCH] Fix log collection crashes. --- coreapi/linphonecore.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 786d96322..4f6d0de46 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -412,7 +412,7 @@ static void clean_log_collection_upload_context(LinphoneCore *lc) { unlink(filename); ms_free(filename); if (lc && lc->log_collection_upload_information) { - ms_free(lc->log_collection_upload_information); + linphone_content_unref(lc->log_collection_upload_information); lc->log_collection_upload_information=NULL; } } @@ -657,8 +657,7 @@ void linphone_core_upload_log_collection(LinphoneCore *core) { belle_http_request_t *req; char *name; - core->log_collection_upload_information = (LinphoneContent *)malloc(sizeof(LinphoneContent)); - memset(core->log_collection_upload_information, 0, sizeof(LinphoneContent)); + core->log_collection_upload_information = linphone_core_create_content(core); #ifdef HAVE_ZLIB linphone_content_set_type(core->log_collection_upload_information, "application"); linphone_content_set_subtype(core->log_collection_upload_information, "gzip"); @@ -671,7 +670,7 @@ void linphone_core_upload_log_collection(LinphoneCore *core) { COMPRESSED_LOG_COLLECTION_EXTENSION); linphone_content_set_name(core->log_collection_upload_information, name); if (prepare_log_collection_file_to_upload(name) <= 0) { - ms_free(core->log_collection_upload_information); + linphone_content_unref(core->log_collection_upload_information); core->log_collection_upload_information = NULL; return; }