Codebase list tcpflow / 57d97ac
removed null checks before delete Simson L. Garfinkel 5 years ago
3 changed file(s) with 8 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
8585 node(node *p):parent(p),ptr0(0),ptr1(0),tsum(),dirty(false),cached_best(){ }
8686 int children() const {return (ptr0 ? 1 : 0) + (ptr1 ? 1 : 0);}
8787 ~node(){
88 if(ptr0){ delete ptr0; ptr0 = 0; }
89 if(ptr1){ delete ptr1; ptr1 = 0; }
88 delete ptr0; ptr0 = 0;
89 delete ptr1; ptr1 = 0;
9090 };
9191 // a node is leaf if tsum>0 and both ptrs are 0.
9292 bool isLeaf() const {
110110 tsum += ptr0->tsum;
111111 tree.cache_remove(ptr0); // remove it from the cache
112112 tree.pruned++;
113 delete ptr0;
114 ptr0=0;
113 delete ptr0; ptr0=0;
115114 tree.nodes--;
116115 removed++;
117116 }
7878 static uint32_t tcp_timeout;
7979 static unsigned int get_max_fds(void); // returns the max
8080 virtual ~tcpdemux(){
81 if(xreport) delete xreport;
82 if(pwriter) delete pwriter;
81 delete xreport;
82 delete pwriter;
8383 }
8484
8585 /* The pure options class means we can add new options without having to modify the tcpdemux constructor. */
102102 tcpip::~tcpip()
103103 {
104104 assert(fd<0); // file must be closed
105 if(seen) delete seen;
105 delete seen; // no need to check to see if seen is null or not.
106106 }
107107
108108 #pragma GCC diagnostic warning "-Weffc++"
527527 fd,out_of_order_count);
528528
529529 /* TK: If we have seen packets, everything in the recon set needs to be shifted as well.*/
530 if(seen){
531 delete seen;
532 seen = 0;
533 }
530 delete seen;
531 seen = 0;
534532 }
535533
536534 /* if we're not at the correct point in the file, seek there */