]> source.dussan.org Git - tigervnc.git/commitdiff
Remove unneeded NULL checks
authorPierre Ossman <ossman@cendio.se>
Thu, 10 Jun 2021 14:36:46 +0000 (16:36 +0200)
committerPierre Ossman <ossman@cendio.se>
Fri, 11 Jun 2021 07:42:44 +0000 (09:42 +0200)
It's perfectly safe to delete NULL pointers, so simplify things by
removing these checks.

common/rfb/CSecurityStack.cxx
common/rfb/CSecurityVeNCrypt.cxx
common/rfb/SSecurityStack.cxx
common/rfb/SSecurityVeNCrypt.cxx

index 55f3133ea6bc90b9c4351d4685178331a35c870d..2541d81efa6de1a7089d84cd3fe6f9f1fea1b9d5 100644 (file)
@@ -32,10 +32,8 @@ CSecurityStack::CSecurityStack(CConnection* cc, int Type, const char* Name,
 
 CSecurityStack::~CSecurityStack()
 {
-  if (state0)
-    delete state0;
-  if (state1)
-    delete state1;
+  delete state0;
+  delete state1;
 }
 
 bool CSecurityStack::processMsg()
index 98dad494b43dcbc64a764d0fbe0c43e503c98a48..a6b270e17277b298c95140733304e2d29f1a6809 100644 (file)
@@ -55,8 +55,7 @@ CSecurityVeNCrypt::CSecurityVeNCrypt(CConnection* cc, SecurityClient* sec)
 
 CSecurityVeNCrypt::~CSecurityVeNCrypt()
 {
-  if (availableTypes)
-       delete[] availableTypes;
+  delete[] availableTypes;
 }
 
 bool CSecurityVeNCrypt::processMsg()
index 74509e7175c25e5660f007ea66a653431c993f64..8139511347c464e8f27f4e288e81faaec328a9e3 100644 (file)
@@ -28,10 +28,8 @@ SSecurityStack::SSecurityStack(SConnection* sc, int Type,
 
 SSecurityStack::~SSecurityStack()
 {
-  if (state0)
-    delete state0;
-  if (state1)
-    delete state1;
+  delete state0;
+  delete state1;
 }
 
 bool SSecurityStack::processMsg()
index 135742c09feeb6422b255faa99b54085260521dd..70d50d20735c98a06cef35dcbd0dcfc42d43111a 100644 (file)
@@ -57,11 +57,7 @@ SSecurityVeNCrypt::SSecurityVeNCrypt(SConnection* sc, SecurityServer *sec)
 SSecurityVeNCrypt::~SSecurityVeNCrypt()
 {
   delete ssecurity;
-
-  if (subTypes) {
-    delete [] subTypes;
-    subTypes = NULL;
-  }
+  delete [] subTypes;
 }
 
 bool SSecurityVeNCrypt::processMsg()