* src/android-asset.h (android_asset_read_internal): Return an
error indication if an exception arises while reading.
(AAsset_getBuffer): Free BUFFER using the C library free
function.
/* Detect error conditions. */
if ((*env)->ExceptionCheck (env))
- goto out;
+ goto out_errno;
/* Detect EOF. */
(*env)->ExceptionClear (env);
(*env)->DeleteLocalRef (env, stash);
return total;
+
+ out_errno:
+ /* Return an error indication if an exception arises while the file
+ is being read. */
+ (*env)->ExceptionClear (env);
+ (*env)->DeleteLocalRef (env, stash);
+ errno = EIO;
+ return -1;
}
static long
if (android_asset_read_internal (asset, length, buffer)
!= length)
{
- xfree (buffer);
+ free (buffer);
return NULL;
}