Merge pull request 'fix: 修复 GiDrawUtility 失败路径内存泄漏(L3-L6)' (#62) from home-lenovo-legion-r9000/fix/gidrawutility-leak-l3-l6 into main

Reviewed-on: #62
Reviewed-by: gjm <littleoldpan@163.com>
This commit was merged in pull request #62.
This commit is contained in:
gjm committed 2026-10-25 18:18:29 +08:00
commit ed996c10bc
1 file changed
+21 -1
@@ -235,7 +235,15 @@ AECDLLIMPEXP AcDbEntity* GiDrawUtility::DrawLoft(const AcDbCurve *pTop
AcDbRegion *pRegT = createRegion(_pTop);
AcDbRegion *pRegB = createRegion(_pBottom);
if (!pRegT || !pRegB) return NULL;
if (!pRegT || !pRegB)
{
DELETE_PTR(pRegT);
DELETE_PTR(pRegB);
DELETE_PTR(_pTop);
DELETE_PTR(_pBottom);
DELETE_PTR(_pLine);
return NULL;
}
AcDbEntity *p = DrawLoft(pRegT, pRegB, pLine);
@@ -367,6 +375,11 @@ AECDLLIMPEXP AcDbEntity* GiDrawUtility::DrawMesh( const Adesk::UInt32 &rows
if (pEnt->createLoftedSolid(vecPLs, vecGuides, &line, op) != Acad::eOk)
{
DELETE_PTR(pEnt);
delete [] pSection;
for (size_t i = 0; i < vecPLs.length(); ++i)
{
if (vecPLs[i]) DELETE_PTR(vecPLs[i]);
}
return NULL;
}
@@ -430,7 +443,10 @@ AECDLLIMPEXP AcDbEntity* GiDrawUtility::DrawBox(const AcGePoint3d &ptPos
AcDb3dSolid *pSolid = new AcDb3dSolid();
if (!pSolid) return NULL;
if (Acad::eOk != pSolid->createBox(X, Y, Z))
{
DELETE_PTR(pSolid);
return NULL;
}
pSolid->transformBy(
RotateAndMove(AcGeVector3d::kZAxis
@@ -447,7 +463,10 @@ AECDLLIMPEXP AcDbEntity* GiDrawUtility::DrawSphere(const AcGePoint3d &ptCenter
AcDb3dSolid *pSolid = new AcDb3dSolid();
if (!pSolid) return NULL;
if (Acad::eOk != pSolid->createSphere(dRadius))
{
DELETE_PTR(pSolid);
return NULL;
}
pSolid->transformBy(
RotateAndMove(AcGeVector3d::kZAxis
@@ -827,6 +846,7 @@ AcDbEntity* GiDrawUtility::DrawPipe(const AcDbCurve *pCurve, double dR)
acutPrintf(_T("\n拉伸错误:%d."), es);
DELETE_PTR(pSolid);
}
DELETE_PTR(pReg);
}
else
{