From bb417daa703b0dd8871470ce53a40b16b1ca300b Mon Sep 17 00:00:00 2001 From: Po Lu Date: Wed, 4 Oct 2023 16:33:05 +0800 Subject: Correct local reference leaks * src/android.c (android_build_string): Accept a list of local references to destroy upon an allocation failure, facilitating the proper deallocation of local references in such situations. (android_browse_url): Revise for new calling convention. * src/android.h (android_build_string): Update declaration correspondingly. * src/androidmenu.c (android_menu_show, android_dialog_show): Revise for new calling convention. * src/androidselect.c (android_notifications_notify_1): Supply each successive local reference to android_build_string as notification text is being encoded. * src/androidvfs.c (android_saf_exception_check): Introduce absent va_end. --- src/androidselect.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/androidselect.c') diff --git a/src/androidselect.c b/src/androidselect.c index cf2265d4cf4..3f025351093 100644 --- a/src/androidselect.c +++ b/src/androidselect.c @@ -613,10 +613,12 @@ android_notifications_notify_1 (Lisp_Object title, Lisp_Object body, (long int) (boot_time.tv_sec / 2), id); /* Encode all strings into their Java counterparts. */ - title1 = android_build_string (title); - body1 = android_build_string (body); - group1 = android_build_string (group); - identifier1 = android_build_jstring (identifier); + title1 = android_build_string (title, NULL); + body1 = android_build_string (body, title1, NULL); + group1 = android_build_string (group, body1, title1, NULL); + identifier1 + = (*android_java_env)->NewStringUTF (android_java_env, identifier); + android_exception_check_3 (title1, body1, group1); /* Create the notification. */ notification -- cgit v1.2.1