Fix a memory leak in mpd compare code

This only affects unittests.

Change-Id: I5deba5ce08c08970ec8b2de9ff5f6f7a7a5a436a
This commit is contained in:
Kongqun Yang 2015-08-20 10:57:51 -07:00 committed by KongQun Yang
parent 368e94941b
commit 0614caed83
3 changed files with 6 additions and 4 deletions

View File

@ -7,7 +7,7 @@
#include "packager/media/base/video_stream_info.h" #include "packager/media/base/video_stream_info.h"
#include "base/logging.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_number_conversions.h"
#include "packager/base/strings/string_util.h" #include "packager/base/strings/string_util.h"
#include "packager/base/strings/stringprintf.h" #include "packager/base/strings/stringprintf.h"

View File

@ -9,10 +9,10 @@
#include <inttypes.h> #include <inttypes.h>
#include <libxml/xmlstring.h> #include <libxml/xmlstring.h>
#include "base/strings/string_piece.h"
#include "packager/base/file_util.h" #include "packager/base/file_util.h"
#include "packager/base/logging.h" #include "packager/base/logging.h"
#include "packager/base/strings/string_number_conversions.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/string_util.h"
#include "packager/base/strings/stringprintf.h" #include "packager/base/strings/stringprintf.h"
#include "packager/media/file/file.h" #include "packager/media/file/file.h"

View File

@ -76,10 +76,12 @@ bool CompareNames(xmlNodePtr node1, xmlNodePtr node2) {
} }
bool CompareContents(xmlNodePtr node1, xmlNodePtr node2) { bool CompareContents(xmlNodePtr node1, xmlNodePtr node2) {
xml::ScopedXmlPtr<xmlChar>::type node1_content_ptr(xmlNodeGetContent(node1));
xml::ScopedXmlPtr<xmlChar>::type node2_content_ptr(xmlNodeGetContent(node2));
std::string node1_content = std::string node1_content =
reinterpret_cast<const char*>(xmlNodeGetContent(node1)); reinterpret_cast<const char*>(node1_content_ptr.get());
std::string node2_content = std::string node2_content =
reinterpret_cast<const char*>(xmlNodeGetContent(node2)); reinterpret_cast<const char*>(node2_content_ptr.get());
base::ReplaceChars(node1_content, "\n", "", &node1_content); base::ReplaceChars(node1_content, "\n", "", &node1_content);
base::TrimString(node1_content, " ", &node1_content); base::TrimString(node1_content, " ", &node1_content);
base::ReplaceChars(node2_content, "\n", "", &node2_content); base::ReplaceChars(node2_content, "\n", "", &node2_content);