PERL-267 memory leak fixes. plus, making sure libson is linked when building