mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
Fix memory leaks
This commit is contained in:
@ -95,6 +95,7 @@ CPdfFile::~CPdfFile()
|
||||
RELEASEOBJECT(m_pInternal->pWriter);
|
||||
RELEASEOBJECT(m_pInternal->pReader);
|
||||
RELEASEOBJECT(m_pInternal->pEditor);
|
||||
RELEASEOBJECT(m_pInternal);
|
||||
}
|
||||
NSFonts::IFontManager* CPdfFile::GetFontManager()
|
||||
{
|
||||
|
||||
@ -614,7 +614,6 @@ std::wstring CPdfReader::GetInfo()
|
||||
std::wstring sRes = L"{";
|
||||
|
||||
Object oInfo;
|
||||
m_pPDFDocument->getDocInfo(&oInfo);
|
||||
if (m_pPDFDocument->getDocInfo(&oInfo)->isDict())
|
||||
{
|
||||
auto fDictLookup = [&oInfo](const char* sName, const wchar_t* wsName)
|
||||
@ -953,6 +952,7 @@ BYTE* CPdfReader::GetLinks(int nPageIndex)
|
||||
if (!sLink)
|
||||
continue;
|
||||
std::string link(sLink->getCString(), sLink->getLength());
|
||||
RELEASEOBJECT(sLink);
|
||||
size_t find = link.find("http://");
|
||||
if (find == std::string::npos)
|
||||
find = link.find("https://");
|
||||
@ -966,6 +966,7 @@ BYTE* CPdfReader::GetLinks(int nPageIndex)
|
||||
oLinks.m_arLinks.push_back({link, 0, x1, y1, x2 - x1, y2 - y1});
|
||||
}
|
||||
}
|
||||
RELEASEOBJECT(pWordList);
|
||||
RELEASEOBJECT(pTextOut);
|
||||
|
||||
return oLinks.Serialize();
|
||||
|
||||
@ -34,7 +34,6 @@
|
||||
#include "../lib/xpdf/TextString.h"
|
||||
#include "../../DesktopEditor/graphics/pro/js/wasm/src/serialize.h"
|
||||
|
||||
|
||||
void GlobalParamsAdaptor::SetFontManager(NSFonts::IFontManager *pFontManager)
|
||||
{
|
||||
m_pFontManager = pFontManager;
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
#include <string>
|
||||
#include <math.h>
|
||||
#include "../lib/xpdf/GfxState.h"
|
||||
#include "../../DesktopEditor/common/Types.h"
|
||||
#include "MemoryUtils.h"
|
||||
|
||||
struct GfxClipMatrix
|
||||
@ -351,6 +352,8 @@ public:
|
||||
~GfxClip()
|
||||
{
|
||||
delete m_pTextClip;
|
||||
for (int i = 0; i < m_vPaths.size(); ++i)
|
||||
RELEASEOBJECT(m_vPaths[i]);
|
||||
}
|
||||
|
||||
void AddPath(GfxPath *pPath, double *Matrix, bool bEo)
|
||||
|
||||
@ -2439,6 +2439,7 @@ void CAnnots::getParents(XRef* xref, Object* oFieldRef)
|
||||
TextString* s = new TextString(oOptJ.getString());
|
||||
pAnnotParent->arrOpt.push_back(NSStringExt::CConverter::GetUtf8FromUTF32(s->getUnicode(), s->getLength()));
|
||||
delete s;
|
||||
oOptJ.free();
|
||||
}
|
||||
if (!pAnnotParent->arrOpt.empty())
|
||||
pAnnotParent->unFlags |= (1 << 6);
|
||||
@ -2455,6 +2456,8 @@ void CAnnots::getParents(XRef* xref, Object* oFieldRef)
|
||||
getParents(xref, &oParentRefObj);
|
||||
}
|
||||
oParentRefObj.free();
|
||||
|
||||
oField.free();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user