Fix memory leak in build_source

(Issue #3.)