From b3ca4ee223abc856a4be4fff946a9092d77f948c Mon Sep 17 00:00:00 2001 From: Eric House Date: Sun, 2 Aug 2015 16:29:53 -0700 Subject: [PATCH] fix off-by-one error that probably had me slowly leaking local obj references for the last few years. --- xwords4/android/XWords4/jni/andutils.c | 4 ++-- xwords4/android/XWords4/jni/andutils.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/xwords4/android/XWords4/jni/andutils.c b/xwords4/android/XWords4/jni/andutils.c index 496cfb8f7..125577d7d 100644 --- a/xwords4/android/XWords4/jni/andutils.c +++ b/xwords4/android/XWords4/jni/andutils.c @@ -687,10 +687,10 @@ void deleteLocalRef( JNIEnv* env, jobject jobj ) } void -deleteLocalRefs( JNIEnv* env, jobject jobj, ... ) +deleteLocalRefs( JNIEnv* env, ... ) { va_list ap; - va_start( ap, jobj ); + va_start( ap, env ); for ( ; ; ) { jobject jnext = va_arg( ap, jobject ); if ( DELETE_NO_REF == jnext ) { diff --git a/xwords4/android/XWords4/jni/andutils.h b/xwords4/android/XWords4/jni/andutils.h index 30e79dce9..c48d3678d 100644 --- a/xwords4/android/XWords4/jni/andutils.h +++ b/xwords4/android/XWords4/jni/andutils.h @@ -101,6 +101,6 @@ jint jEnumToInt( JNIEnv* env, jobject jenum ); XP_U32 getCurSeconds( JNIEnv* env ); void deleteLocalRef( JNIEnv* env, jobject jobj ); -void deleteLocalRefs( JNIEnv* env, jobject jobj, ... ); +void deleteLocalRefs( JNIEnv* env, ... ); # define DELETE_NO_REF ((jobject)-1) /* terminates above varargs list */ #endif