« Return to Thread: memory allocation bug in C client library

memory allocation bug in C client library

by Theo Schlossnagle :: Rate this Message:

Reply to Author | View in Thread

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;

 « Return to Thread: memory allocation bug in C client library