fix mem leak on error handling
Frameworks_native: TRDS 2.0 (2/3)