We are running static analyzers on new code. There is many false positives, but between them we can find some real issues, that would be worth fixing, including some double-free, use-after-free, buffer-overruns or usage of uninitialized variables
The fixes are attached in the following patch:
Analysis was executed on version 2.4.4, patches are for master.