From 21e954b59fcef1b84fdcdb9ae337e2d4c060b19e Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 8 Feb 2017 10:05:05 -0500 Subject: Remove CopyToLocal from CFDE_CSSDeclaration This CL removes the CopyToLocal method and creates CFX_WideString's directly. This fixes several memory leaks as the CopyToLocal strings were not cleaned up correctly. Change-Id: Ie5ba4cdc4d713cd0b8e3fb85e02f27dc09f38af1 Reviewed-on: https://pdfium-review.googlesource.com/2553 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- xfa/fde/css/cfde_cssselector.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'xfa/fde/css/cfde_cssselector.cpp') diff --git a/xfa/fde/css/cfde_cssselector.cpp b/xfa/fde/css/cfde_cssselector.cpp index 6d181ac325..03580236f5 100644 --- a/xfa/fde/css/cfde_cssselector.cpp +++ b/xfa/fde/css/cfde_cssselector.cpp @@ -53,13 +53,14 @@ CFDE_CSSSelector* CFDE_CSSSelector::GetNextSelector() const { return m_pNext.get(); } +// static. std::unique_ptr CFDE_CSSSelector::FromString( - const FX_WCHAR* psz, - int32_t iLen) { - ASSERT(psz && iLen > 0); + const CFX_WideStringC& str) { + ASSERT(!str.IsEmpty()); + const FX_WCHAR* psz = str.c_str(); const FX_WCHAR* pStart = psz; - const FX_WCHAR* pEnd = psz + iLen; + const FX_WCHAR* pEnd = psz + str.GetLength(); for (; psz < pEnd; ++psz) { switch (*psz) { case '>': -- cgit v1.2.3