Fix memory leaks (found by ASAN)
Summary:
They don't matter much in practice, except that they make an
ASAN-enabled build abort when protocolgen is running.
Test Plan: make protocolgen && make -j1, in an ASAN build => protocolgen no longer aborts the build
Reviewers: dvratil
Reviewed By: dvratil
Subscribers: kde-pim
Tags: KDE PIM
Differential Revision: https://phabricator.kde.org/D21068