[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1176416 - /subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp

From: Blair Zajac <blair_at_orcaware.com>
Date: Tue, 27 Sep 2011 21:27:50 -0700

On Sep 27, 2011, at 7:56 AM, hwright_at_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
Received on 2011-09-28 06:28:33 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.