Author: kkolinko
Date: Wed Jul  2 08:45:42 2014
New Revision: 1607296

URL: http://svn.apache.org/r1607296
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.
Merged r1607291 from tomcat/native/trunk.
Not tested, but an obvious fix.

Modified:
    tomcat/native/branches/1.1.x/   (props changed)
    tomcat/native/branches/1.1.x/native/src/network.c
    tomcat/native/branches/1.1.x/xdocs/miscellaneous/changelog.xml

Propchange: tomcat/native/branches/1.1.x/
------------------------------------------------------------------------------
  Merged /tomcat/native/trunk:r1607291

Modified: tomcat/native/branches/1.1.x/native/src/network.c
URL: 
http://svn.apache.org/viewvc/tomcat/native/branches/1.1.x/native/src/network.c?rev=1607296&r1=1607295&r2=1607296&view=diff
==============================================================================
--- tomcat/native/branches/1.1.x/native/src/network.c (original)
+++ tomcat/native/branches/1.1.x/native/src/network.c Wed Jul  2 08:45:42 2014
@@ -719,13 +719,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)

Modified: tomcat/native/branches/1.1.x/xdocs/miscellaneous/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/native/branches/1.1.x/xdocs/miscellaneous/changelog.xml?rev=1607296&r1=1607295&r2=1607296&view=diff
==============================================================================
--- tomcat/native/branches/1.1.x/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/native/branches/1.1.x/xdocs/miscellaneous/changelog.xml Wed Jul  2 
08:45:42 2014
@@ -40,7 +40,8 @@
   <changelog>
     <fix>
       <bug>55938</bug>: Fix "Dereference of null pointer" issues in rarely
-      used methods in ssl.c, as identified by clang-analyzer. (kkolinko)
+      used methods in ssl.c. Fix possible memory leak in Socket.sendto().
+      The issues were identified with clang-analyzer. (kkolinko)
     </fix>
     <fix>
       <bug>56396</bug>: Do not create RSA keys shorter the 1024 bits



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to