Index: fpdfsdk/fpdf_transformpage.cpp |
diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp |
index 7b2bf7387110634aa099d5d5d880d473718a1ca2..3b607bfa69327be80b08ed5a131f5e569d49bc7a 100644 |
--- a/fpdfsdk/fpdf_transformpage.cpp |
+++ b/fpdfsdk/fpdf_transformpage.cpp |
@@ -125,15 +125,16 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, |
if (!pContentObj) |
return FALSE; |
- CPDF_Dictionary* pDic = new CPDF_Dictionary; |
- CPDF_Stream* pStream = new CPDF_Stream(nullptr, 0, pDic); |
- pStream->SetData(textBuf.GetBuffer(), textBuf.GetSize(), FALSE, FALSE); |
CPDF_Document* pDoc = pPage->m_pDocument; |
if (!pDoc) |
return FALSE; |
+ |
+ CPDF_Dictionary* pDic = new CPDF_Dictionary(pDoc); |
+ CPDF_Stream* pStream = new CPDF_Stream(nullptr, 0, pDic); |
+ pStream->SetData(textBuf.GetBuffer(), textBuf.GetSize(), FALSE, FALSE); |
dsinclair
2016/09/19 13:24:34
Previously this would SetData regardless of the va
Tom Sepez
2016/09/19 18:25:00
Yes, it would be a leak in that case as the new st
|
pDoc->AddIndirectObject(pStream); |
+ pDic = new CPDF_Dictionary(pDoc); |
- pDic = new CPDF_Dictionary; |
CPDF_Stream* pEndStream = new CPDF_Stream(nullptr, 0, pDic); |
pEndStream->SetData((const uint8_t*)" Q", 2, FALSE, FALSE); |
pDoc->AddIndirectObject(pEndStream); |
@@ -300,12 +301,13 @@ DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page, |
strClip << "W* n\n"; |
} |
} |
- CPDF_Dictionary* pDic = new CPDF_Dictionary; |
- CPDF_Stream* pStream = new CPDF_Stream(nullptr, 0, pDic); |
- pStream->SetData(strClip.GetBuffer(), strClip.GetSize(), FALSE, FALSE); |
CPDF_Document* pDoc = pPage->m_pDocument; |
if (!pDoc) |
return; |
+ |
+ CPDF_Dictionary* pDic = new CPDF_Dictionary(pDoc); |
+ CPDF_Stream* pStream = new CPDF_Stream(nullptr, 0, pDic); |
+ pStream->SetData(strClip.GetBuffer(), strClip.GetSize(), FALSE, FALSE); |
dsinclair
2016/09/19 13:24:34
ditto
Tom Sepez
2016/09/19 18:25:00
ditto
|
pDoc->AddIndirectObject(pStream); |
CPDF_Array* pContentArray = nullptr; |