Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1951)

Unified Diff: core/fxcrt/include/fx_basic.h

Issue 1998583002: Fix leak in CPDF_StreamContentParser::AddTextObject(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: CollectionSize Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfapi/fpdf_render/fpdf_render_text.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxcrt/include/fx_basic.h
diff --git a/core/fxcrt/include/fx_basic.h b/core/fxcrt/include/fx_basic.h
index 1835d9e0a6d5cb6ab75dca07d275f6bcd3310d03..7fdfbf699dd7406567dc6547822feabb38194a4d 100644
--- a/core/fxcrt/include/fx_basic.h
+++ b/core/fxcrt/include/fx_basic.h
@@ -717,53 +717,22 @@ class CFX_CountRef {
}
}
- ~CFX_CountRef() {
- if (!m_pObject) {
- return;
- }
- m_pObject->m_RefCount--;
- if (m_pObject->m_RefCount <= 0) {
- delete m_pObject;
- }
- }
+ ~CFX_CountRef() { SetNull(); }
ObjClass* New() {
- if (m_pObject) {
- m_pObject->m_RefCount--;
- if (m_pObject->m_RefCount <= 0) {
- delete m_pObject;
- }
- }
+ SetNull();
m_pObject = new CountedObj;
m_pObject->m_RefCount = 1;
return m_pObject;
}
void operator=(const Ref& ref) {
- if (ref.m_pObject) {
+ if (ref.m_pObject)
ref.m_pObject->m_RefCount++;
- }
- if (m_pObject) {
- m_pObject->m_RefCount--;
- if (m_pObject->m_RefCount <= 0) {
- delete m_pObject;
- }
- }
+ SetNull();
m_pObject = ref.m_pObject;
}
- void operator=(void* p) {
- ASSERT(p == 0);
- if (!m_pObject) {
- return;
- }
- m_pObject->m_RefCount--;
- if (m_pObject->m_RefCount <= 0) {
- delete m_pObject;
- }
- m_pObject = NULL;
- }
-
const ObjClass* GetObject() const { return m_pObject; }
operator const ObjClass*() const { return m_pObject; }
« no previous file with comments | « core/fpdfapi/fpdf_render/fpdf_render_text.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698