From e21cc4af9d4b6ea4056569e248f928dc30f8a5d7 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Thu, 17 Apr 2014 16:33:02 +0200 Subject: [PATCH] Quality reporting: do not publish report if we hung up too early (empty local IP address) --- coreapi/quality_reporting.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/coreapi/quality_reporting.c b/coreapi/quality_reporting.c index 998837963..441957736 100644 --- a/coreapi/quality_reporting.c +++ b/coreapi/quality_reporting.c @@ -232,8 +232,15 @@ static void reporting_publish(const LinphoneCall* call, const reporting_session_ size_t size = 2048; char * buffer; - buffer = (char *) ms_malloc(size); + // if the call was hungup too early, we might have invalid IPs information + // in that case, we abort the report since it's not useful data + if (strlen(report->info.local_addr.ip) == 0 || strlen(report->info.remote_addr.ip) == 0) { + ms_warning("The call was hang up too early (duration: %d sec) and IP could " + "not be retrieved so dropping this report", linphone_call_get_duration(call)); + return; + } + buffer = (char *) ms_malloc(size); content.type = ms_strdup("application"); content.subtype = ms_strdup("vq-rtcpxr");