From: Po Lu Date: Sat, 9 Sep 2023 07:49:47 +0000 (+0800) Subject: Update Android port X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8b9d25b4087df936d51aacd137affbce6469d717;p=emacs.git Update Android port * 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. --- diff --git a/src/android-asset.h b/src/android-asset.h index 4fb309f1645..d7cf0f0cfed 100644 --- a/src/android-asset.h +++ b/src/android-asset.h @@ -340,7 +340,7 @@ android_asset_read_internal (AAsset *asset, int nbytes, char *buffer) /* Detect error conditions. */ if ((*env)->ExceptionCheck (env)) - goto out; + goto out_errno; /* Detect EOF. */ @@ -363,6 +363,14 @@ android_asset_read_internal (AAsset *asset, int nbytes, char *buffer) (*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 @@ -399,7 +407,7 @@ AAsset_getBuffer (AAsset *asset) if (android_asset_read_internal (asset, length, buffer) != length) { - xfree (buffer); + free (buffer); return NULL; }