fixed mem leak from poor matches malloc location