aboutsummaryrefslogtreecommitdiffstats
path: root/src/androidselect.c
diff options
context:
space:
mode:
authorPo Lu2025-03-16 20:12:52 +0800
committerPo Lu2025-03-16 20:13:34 +0800
commit2d5cf228186184b5af6e4e8ee8f5280f67f407bc (patch)
tree75daeac4279e449faa13ffa46d3f3c19ba350e42 /src/androidselect.c
parentb6b4a080a3abb5a45b680e26f93dd17adbb75f69 (diff)
downloademacs-2d5cf228186184b5af6e4e8ee8f5280f67f407bc.tar.gz
emacs-2d5cf228186184b5af6e4e8ee8f5280f67f407bc.zip
Fix clipboard object handle leak on Android 3.1 to 11.0
* src/androidselect.c (extract_fd_offsets): Release retrieved ParcelFileDescriptor objects on APIs 12 through 30.
Diffstat (limited to 'src/androidselect.c')
-rw-r--r--src/androidselect.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/androidselect.c b/src/androidselect.c
index 8d3cfac1df9..337747cbcb4 100644
--- a/src/androidselect.c
+++ b/src/androidselect.c
@@ -418,7 +418,10 @@ close_asset_fd (void *afd)
418} 418}
419 419
420/* Return the offset, file descriptor and length of the data contained 420/* Return the offset, file descriptor and length of the data contained
421 in the asset file descriptor AFD, in *FD, *OFFSET, and *LENGTH. 421 in the asset file descriptor AFD, in *FD, *OFFSET, and *LENGTH. AFD
422 will not be released if an exception is detected; it is the
423 responsibility of the caller to arrange that it be.
424
422 Value is 0 upon success, 1 otherwise. */ 425 Value is 0 upon success, 1 otherwise. */
423 426
424static int 427static int
@@ -487,6 +490,9 @@ extract_fd_offsets (jobject afd, int *fd, jlong *offset, jlong *length)
487 *fd = (*android_java_env)->CallIntMethod (android_java_env, 490 *fd = (*android_java_env)->CallIntMethod (android_java_env,
488 java_fd, 491 java_fd,
489 fd_class.get_fd); 492 fd_class.get_fd);
493 android_exception_check_1 (java_fd);
494 ANDROID_DELETE_LOCAL_REF (java_fd);
495
490 if (*fd >= 0) 496 if (*fd >= 0)
491 return 0; 497 return 0;
492 } 498 }