From 320db534593310be20544261b89767d10cd1019d Mon Sep 17 00:00:00 2001 From: Andrzej Popowski Date: Mon, 8 Jun 2015 15:13:09 +0200 Subject: [PATCH] [Download] - fixing memory leaks Change-Id: Ia274fd8f4b2a45f98500f12e0c897f9c336e58d4 Signed-off-by: Andrzej Popowski --- src/download/download_instance.cc | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/download/download_instance.cc b/src/download/download_instance.cc index 8b4ca3e..abcf635 100755 --- a/src/download/download_instance.cc +++ b/src/download/download_instance.cc @@ -202,6 +202,9 @@ gboolean DownloadInstance::OnFinished(void* user_data) { out["fullPath"] = picojson::value(fullPath); downCbPtr->instance->PostMessage(picojson::value(out).serialize().c_str()); + + free(fullPath); + return FALSE; } @@ -757,17 +760,18 @@ void DownloadInstance::DownloadManagerGetmimetype } else if (ret == DOWNLOAD_ERROR_INVALID_PARAMETER) { ReportError(InvalidValuesException( "The input parameter contains an invalid value."), out); - } else if (ret == DOWNLOAD_ERROR_OUT_OF_MEMORY) { - ReportError(UnknownException("Out of memory"), out); - } else if (ret == DOWNLOAD_ERROR_INVALID_STATE) { - ReportError(InvalidValuesException("Invalid state"), out); - } else if (ret == DOWNLOAD_ERROR_IO_ERROR) { - ReportError(UnknownException("Internal I/O error"), out); - } else if (ret == DOWNLOAD_ERROR_PERMISSION_DENIED) { - ReportError(UnknownException("Permission denied"), out); - } else { - ReportError(UnknownException("Unknown Error"), out); - } + } else if (ret == DOWNLOAD_ERROR_OUT_OF_MEMORY) { + ReportError(UnknownException("Out of memory"), out); + } else if (ret == DOWNLOAD_ERROR_INVALID_STATE) { + ReportError(InvalidValuesException("Invalid state"), out); + } else if (ret == DOWNLOAD_ERROR_IO_ERROR) { + ReportError(UnknownException("Internal I/O error"), out); + } else if (ret == DOWNLOAD_ERROR_PERMISSION_DENIED) { + ReportError(UnknownException("Permission denied"), out); + } else { + ReportError(UnknownException("Unknown Error"), out); + } + free(mimetype); } bool DownloadInstance::GetDownloadID -- 2.7.4