Fix memory leaks in MPGetObjectFromJavaScript