On Sep 27, 2011, at 7:56 AM, hwri...@apache.org wrote:

> Author: hwright
> Date: Tue Sep 27 14:56:56 2011
> New Revision: 1176416
> 
> 
> Modified: subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp
> URL: 
> http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp?rev=1176416&r1=1176415&r2=1176416&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp (original)
> +++ subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp Tue Sep 27 
> 14:56:56 2011
> @@ -474,9 +474,9 @@ void JNIUtil::handleSVNError(svn_error_t
>       if (isJavaExceptionThrown())
>         POP_AND_RETURN_NOTHING();
>     }
> -  Array stackTraceArray((jobjectArray) env->CallObjectMethod(nativeException,
> -                                                             mid_gst));
> -  std::vector<jobject> oldStackTrace = stackTraceArray.vector();
> +  Array *stackTraceArray =
> +    new Array((jobjectArray) env->CallObjectMethod(nativeException, 
> mid_gst));
> +  std::vector<jobject> oldStackTrace = stackTraceArray->vector();
> 
>   // Build the new stack trace elements from the chained errors.
>   std::vector<jobject> newStackTrace;
> @@ -506,6 +506,8 @@ void JNIUtil::handleSVNError(svn_error_t
>       ++i;
>     }
> 
> +  delete stackTraceArray;

Hi Hyrum,

Out of curiosity, since I'm not familiar with JNI coding, is there a chance of 
memory leak here if an exception is thrown before the delete?  Or is using 
something like std::auto_ptr a good idea?

Blair

Reply via email to