fix some memory leaks in native code