summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-09-28 16:53:10 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-28 16:53:11 -0700
commit5ef75ba52b1ce6024d6aa43b03e25824a04b469b (patch)
tree774b618bf60a6156769d990d9b43e41c064a6770
parent698c5716d005860360527e4cfe15b4a185589117 (diff)
downloadpdfium-5ef75ba52b1ce6024d6aa43b03e25824a04b469b.tar.xz
Fix leaks in CFieldTree::Node.
Correctly account for non-leaf Nodes that have CPDF_FormField pointers. Review-Url: https://codereview.chromium.org/2376193002
-rw-r--r--core/fpdfdoc/cpdf_interform.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/fpdfdoc/cpdf_interform.cpp b/core/fpdfdoc/cpdf_interform.cpp
index 29063f534b..af72bd2750 100644
--- a/core/fpdfdoc/cpdf_interform.cpp
+++ b/core/fpdfdoc/cpdf_interform.cpp
@@ -428,7 +428,6 @@ class CFieldTree {
return m_pField;
--*pFieldsToGo;
- return nullptr;
}
for (size_t i = 0; i < GetChildrenCount(); ++i) {
CPDF_FormField* pField = GetChildAt(i)->GetFieldInternal(pFieldsToGo);
@@ -441,10 +440,11 @@ class CFieldTree {
size_t CountFieldsInternal(int nLevel) const {
if (nLevel > nMaxRecursion)
return 0;
- if (m_pField)
- return 1;
size_t count = 0;
+ if (m_pField)
+ ++count;
+
for (size_t i = 0; i < GetChildrenCount(); ++i)
count += GetChildAt(i)->CountFieldsInternal(nLevel + 1);
return count;