fix mem leak on error handling thx cyanogenmod