Wireshark-dev: [Wireshark-dev] CaptureEvent is leaking for every event

From: Peter Wu <peter@xxxxxxxxxxxxx>
Date: Sun, 25 Mar 2018 23:22:55 +0200
Hi Roland and others,

Since v2.5.0rc0-2085-gd5d815189d, there is a memory leak for every
capture event. One of the many events (as reported by LeakSanitizer):

    Indirect leak of 112 byte(s) in 1 object(s) allocated from:
        #0 0x55641541d1a1 in operator new(unsigned long) (run/wireshark+0x16251a1)
        #1 0x7feb853f9162 in QObject::QObject(QObject*) (/usr/lib/libQt5Core.so.5+0x2d5162)
        #2 0x556415471215 in CaptureEvent::CaptureEvent(CaptureEvent::Context, CaptureEvent::EventType) ui/qt/capture_file.cpp:31:15
        #3 0x5564154740d2 in CaptureFile::captureFileEvent(int, void*) ui/qt/capture_file.cpp:215:31
        #4 0x5564154376d2 in cf_callback_invoke file.c:145:5
        #5 0x556415438a72 in cf_read file.c
        #6 0x5564155abe20 in MainWindow::openCaptureFile(QString, QString, unsigned int, int) ui/qt/main_window_slots.cpp:249:17
        #7 0x556415423ea0 in main wireshark-qt.cpp:851:21
        #8 0x7feb83a44f49 in __libc_start_main (/usr/lib/libc.so.6+0x20f49)
        #9 0x556415320629 in _start (run/wireshark+0x1528629)

This looks fishy, a new instance is created every time, but who is
responsible for cleaning it up?

    case(cf_cb_file_read_finished):
        emit captureEvent(new CaptureEvent(CaptureEvent::File, CaptureEvent::Finished));
        break;

Could you have a look?
-- 
Kind regards,
Peter Wu
https://lekensteyn.nl