summaryrefslogtreecommitdiffstats
path: root/generic/tkbltGrElemOp.C
diff options
context:
space:
mode:
authorAdrián Medraño Calvo <adrian@medranocalvo.com>2017-07-28 06:54:06 (GMT)
committerAdrián Medraño Calvo <adrian@medranocalvo.com>2017-07-28 07:11:19 (GMT)
commitd2c078754fbaee1bd22d77202f9af3d706f45b94 (patch)
treede4a975872eca1b01fc9ac74f175af98e7283ee5 /generic/tkbltGrElemOp.C
parente8635888a9d67eff399ad5d5fdded50dcc7e843a (diff)
downloadblt-d2c078754fbaee1bd22d77202f9af3d706f45b94.zip
blt-d2c078754fbaee1bd22d77202f9af3d706f45b94.tar.gz
blt-d2c078754fbaee1bd22d77202f9af3d706f45b94.tar.bz2
Stop checking for NULL before free
The 'delete' operator checks whether the lvalue is NULL before freeing.
Diffstat (limited to 'generic/tkbltGrElemOp.C')
-rw-r--r--generic/tkbltGrElemOp.C11
1 files changed, 4 insertions, 7 deletions
diff --git a/generic/tkbltGrElemOp.C b/generic/tkbltGrElemOp.C
index c4bcbef..af6fc0c 100644
--- a/generic/tkbltGrElemOp.C
+++ b/generic/tkbltGrElemOp.C
@@ -174,10 +174,9 @@ static int ActivateOp(ClientData clientData, Tcl_Interp* interp,
}
}
- if (elemPtr->activeIndices_)
- delete [] elemPtr->activeIndices_;
- elemPtr->nActiveIndices_ = nIndices;
+ delete [] elemPtr->activeIndices_;
elemPtr->activeIndices_ = indices;
+ elemPtr->nActiveIndices_ = nIndices;
elemPtr->active_ = 1;
@@ -306,10 +305,8 @@ static int DeactivateOp(ClientData clientData, Tcl_Interp* interp,
if (graphPtr->getElement(objv[ii], &elemPtr) != TCL_OK)
return TCL_ERROR;
- if (elemPtr->activeIndices_) {
- delete [] elemPtr->activeIndices_;
- elemPtr->activeIndices_ = NULL;
- }
+ delete [] elemPtr->activeIndices_;
+ elemPtr->activeIndices_ = NULL;
elemPtr->nActiveIndices_ = 0;
elemPtr->active_ = 0;
}