Author: kkolinko Date: Wed Jul 2 08:36:11 2014 New Revision: 1607291 URL: http://svn.apache.org/r1607291 Log: For https://issues.apache.org/bugzilla/show_bug.cgi?id=55938 Fix "Dead assignment" issue identified by clang-analyzer, in Socket.sendto(). I expect that this bug would have lead to a memory leak, as GetByteArrayElements was not followed by ReleaseByteArrayElements. This method is never called by the current Tomcat 8, 7 or 6. Not tested, but an obvious fix.
Modified: tomcat/native/trunk/native/src/network.c Modified: tomcat/native/trunk/native/src/network.c URL: http://svn.apache.org/viewvc/tomcat/native/trunk/native/src/network.c?rev=1607291&r1=1607290&r2=1607291&view=diff ============================================================================== --- tomcat/native/trunk/native/src/network.c (original) +++ tomcat/native/trunk/native/src/network.c Wed Jul 2 08:36:11 2014 @@ -697,13 +697,12 @@ TCN_IMPLEMENT_CALL(jint, Socket, sendto) TCN_ASSERT(sock != 0); TCN_ASSERT(s->sock != NULL); - bytes = (*e)->GetByteArrayElements(e, buf, NULL); - TCN_ASSERT(bytes != NULL); apr_socket_opt_get(s->sock, APR_SO_NONBLOCK, &nb); if (nb) bytes = (*e)->GetPrimitiveArrayCritical(e, buf, NULL); else bytes = (*e)->GetByteArrayElements(e, buf, NULL); + TCN_ASSERT(bytes != NULL); ss = apr_socket_sendto(s->sock, w, flag, (char *)(bytes + offset), &nbytes); if (nb) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org