memory allocation bug in C client library

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

memory allocation bug in C client library

Theo Schlossnagle
You currently underallocate the connection in the pool.  Patch follows:


Index: trunk/c/src/stomp.c
===================================================================
--- stomp.c (revision 88)
+++ stomp.c (working copy)
@@ -35,7 +35,7 @@
        //
        // Allocate the connection and a memory pool for the connection.
        //
- connection = apr_pcalloc(pool, sizeof(connection));
+ connection = apr_pcalloc(pool, sizeof(*connection));
        if( connection == NULL )
                return APR_ENOMEM;
Reply | Threaded
Open this post in threaded view
|

Re: memory allocation bug in C client library

Jeff Ward
Hey Theo,

This is fixed in svn now.  Using sizeof(stomp_conneciton) over sizeof(*conneciton);

--
Jeff

On Wed, May 27, 2009 at 1:28 PM, Theo Schlossnagle <[hidden email]> wrote:

You currently underallocate the connection in the pool.  Patch follows:


Index: trunk/c/src/stomp.c
===================================================================
--- stomp.c     (revision 88)
+++ stomp.c     (working copy)
@@ -35,7 +35,7 @@
       //
       // Allocate the connection and a memory pool for the connection.
       //
-       connection = apr_pcalloc(pool, sizeof(connection));
+       connection = apr_pcalloc(pool, sizeof(*connection));
       if( connection == NULL )
               return APR_ENOMEM;

--
View this message in context: http://www.nabble.com/memory-allocation-bug-in-C-client-library-tp23747094p23747094.html
Sent from the stomp - dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email