If you directly call the operator new function, you must also directly
call the operator delete function, and must manually call the
destructor as well.
Fixes: http://tracker.ceph.com/issues/23324
Signed-off-by: Brad Hubbard <bhubbard@redhat.com>
(cherry picked from commit
0fe0c1173b1b3efcb407c22e736d0e2d94bf5840)
Conflicts:
src/log/Entry.h: Resolved for Entry destructor
}
}
+private:
+ ~Entry() = default;
+
+public:
// function improves estimate for expected size of message
void hint_size() {
if (m_exp_len != NULL) {
int snprintf(char* dst, size_t avail) const {
return m_streambuf.snprintf(dst, avail);
}
+
+ void destroy() {
+ if (m_exp_len != NULL) {
+ this->~Entry();
+ ::operator delete(this);
+ } else {
+ delete(this);
+ }
+ }
};
}
Entry *t;
while (m_head) {
t = m_head->m_next;
- delete m_head;
+ m_head->destroy();
m_head = t;
}
}
// trim
while (m_recent.m_len > m_max_recent) {
- delete m_recent.dequeue();
+ m_recent.dequeue()->destroy();
}
m_flush_mutex_holder = 0;