master: fix a couple of resource leaks

Reported by Coverity as CID #1141954
Merge pull request #490 from xrmx/coverity2312-2

master: fix a couple of resource leaks