This prevents fde::timeoutHandler and fde::closeHandler memory leaks but there
will probably be more corruption as fde data members are added or changed.
Made fde::clean() private to prevent it from spreading through the code.
Use a new fde object to clean an old one, for now.
F->flags.open = 0;
fdUpdateBiggest(fd, 0);
Number_FD--;
- F->clear();
- F->timeout = 0;
+ *F = fde();
}
#ifdef _SQUID_MSWIN_
public:
fde() { clear(); };
- /** Clear the fde class properly back to NULL equivalent. */
- inline void clear() {
- memset(this, 0, sizeof(fde));
- local_addr.SetEmpty(); // IPAddress likes to be setup nicely.
- }
/**
* Return true if the the comm_close for this fd called.
unsigned char upstreamTOS; /* see FwdState::dispatch() */
#endif
+private:
+ /** Clear the fde class back to NULL equivalent. */
+ inline void clear() {
+ timeoutHandler = NULL;
+ closeHandler = NULL;
+ // XXX: the following memset may corrupt or leak new or changed members
+ memset(this, 0, sizeof(fde));
+ local_addr.SetEmpty(); // IPAddress likes to be setup nicely.
+ }
+
};
#endif /* SQUID_FDE_H */