mmsd: Fix various memory leaks
This commit also sets initial value of 'savepath' to NULL, so that it won't point to any invalid memory.
Likely fixes #674 (closed)
/cc @kop316 @scottt @lafleur (let me know if this MR fixes the crash). You can get the installable .deb
package from the CI (from the green check button once build is completed)