From 01cd6f6d1a719bbc91dc6af8c723322b6e9f8db8 Mon Sep 17 00:00:00 2001 From: Jihoon Chung Date: Fri, 25 Oct 2013 10:38:35 +0900 Subject: [PATCH] Fix Mismatched free (iri_t) [Issue#] LINUXWRT-1065 [Problem] As a result of valgrind, memory mismatched free detected. [Cause] Iri data structure, "iri_t", should be alloc by iri_parse and released by iri_destory. Some part doesn't use "iri_destory" when release "iri_t". [Solution] Change use case from DPL::ScropedPtr to unique_ptr with deleter(iri_destory). [Verification] Retest valgrind. [SCMRequest] N/A Change-Id: Icbd1e741a1a6545980afc8e4650767309fdf14e1 --- src/configuration_parser/widget_parser.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/configuration_parser/widget_parser.cpp b/src/configuration_parser/widget_parser.cpp index e8b832d..e00b84e 100644 --- a/src/configuration_parser/widget_parser.cpp +++ b/src/configuration_parser/widget_parser.cpp @@ -25,6 +25,20 @@ * @brief */ #include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + #include #include #include @@ -33,19 +47,8 @@ #include #include -#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include @@ -2244,7 +2247,7 @@ class AllowNavigationParser : public ElementParser continue; } - DPL::ScopedPtr iri(iri_parse(origin.c_str())); + std::unique_ptr iri(iri_parse(origin.c_str()), iri_destroy); if (!iri->host || strlen(iri->host) == 0) { // input origin should has schem and host // in case of file scheme path is filled -- 2.7.4