From 0614caed83b47e4687908e3c95e43752ba9d4b40 Mon Sep 17 00:00:00 2001 From: Kongqun Yang Date: Thu, 20 Aug 2015 10:57:51 -0700 Subject: [PATCH] Fix a memory leak in mpd compare code This only affects unittests. Change-Id: I5deba5ce08c08970ec8b2de9ff5f6f7a7a5a436a --- packager/media/base/video_stream_info.cc | 2 +- packager/mpd/base/mpd_builder_unittest.cc | 2 +- packager/mpd/test/xml_compare.cc | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packager/media/base/video_stream_info.cc b/packager/media/base/video_stream_info.cc index 52b287a2e6..f3c7ed942a 100644 --- a/packager/media/base/video_stream_info.cc +++ b/packager/media/base/video_stream_info.cc @@ -7,7 +7,7 @@ #include "packager/media/base/video_stream_info.h" #include "base/logging.h" -#include "base/stl_util.h" +#include "packager/base/stl_util.h" #include "packager/base/strings/string_number_conversions.h" #include "packager/base/strings/string_util.h" #include "packager/base/strings/stringprintf.h" diff --git a/packager/mpd/base/mpd_builder_unittest.cc b/packager/mpd/base/mpd_builder_unittest.cc index f83e1aee84..8497286fa4 100644 --- a/packager/mpd/base/mpd_builder_unittest.cc +++ b/packager/mpd/base/mpd_builder_unittest.cc @@ -9,10 +9,10 @@ #include #include -#include "base/strings/string_piece.h" #include "packager/base/file_util.h" #include "packager/base/logging.h" #include "packager/base/strings/string_number_conversions.h" +#include "packager/base/strings/string_piece.h" #include "packager/base/strings/string_util.h" #include "packager/base/strings/stringprintf.h" #include "packager/media/file/file.h" diff --git a/packager/mpd/test/xml_compare.cc b/packager/mpd/test/xml_compare.cc index afb025c059..0b08828167 100644 --- a/packager/mpd/test/xml_compare.cc +++ b/packager/mpd/test/xml_compare.cc @@ -76,10 +76,12 @@ bool CompareNames(xmlNodePtr node1, xmlNodePtr node2) { } bool CompareContents(xmlNodePtr node1, xmlNodePtr node2) { + xml::ScopedXmlPtr::type node1_content_ptr(xmlNodeGetContent(node1)); + xml::ScopedXmlPtr::type node2_content_ptr(xmlNodeGetContent(node2)); std::string node1_content = - reinterpret_cast(xmlNodeGetContent(node1)); + reinterpret_cast(node1_content_ptr.get()); std::string node2_content = - reinterpret_cast(xmlNodeGetContent(node2)); + reinterpret_cast(node2_content_ptr.get()); base::ReplaceChars(node1_content, "\n", "", &node1_content); base::TrimString(node1_content, " ", &node1_content); base::ReplaceChars(node2_content, "\n", "", &node2_content);