qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tr...@apache.org
Subject svn commit: r1597126 - in /qpid/dispatch/trunk/src: alloc.c server.c
Date Fri, 23 May 2014 17:00:06 GMT
Author: tross
Date: Fri May 23 17:00:06 2014
New Revision: 1597126

URL: http://svn.apache.org/r1597126
Log:
DISPATCH-46 - Don't dereference a null connector in listen

Modified:
    qpid/dispatch/trunk/src/alloc.c
    qpid/dispatch/trunk/src/server.c

Modified: qpid/dispatch/trunk/src/alloc.c
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/src/alloc.c?rev=1597126&r1=1597125&r2=1597126&view=diff
==============================================================================
--- qpid/dispatch/trunk/src/alloc.c (original)
+++ qpid/dispatch/trunk/src/alloc.c Fri May 23 17:00:06 2014
@@ -321,7 +321,7 @@ void qd_alloc_finalize(void)
         // Check the stats for lost items
         //
         if (desc->stats->total_free_to_heap < desc->stats->total_alloc_from_heap)
-            fprintf(stderr, "alloc.c: Items of type '%s' remain allocated at shutdown: %"PRIx64"\n",
+            fprintf(stderr, "alloc.c: Items of type '%s' remain allocated at shutdown: %"PRId64"\n",
                     desc->type_name,
                     desc->stats->total_alloc_from_heap - desc->stats->total_free_to_heap);
 

Modified: qpid/dispatch/trunk/src/server.c
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/src/server.c?rev=1597126&r1=1597125&r2=1597126&view=diff
==============================================================================
--- qpid/dispatch/trunk/src/server.c (original)
+++ qpid/dispatch/trunk/src/server.c Fri May 23 17:00:06 2014
@@ -56,12 +56,15 @@ static qd_thread_t *thread(qd_server_t *
 static void thread_process_listeners(qd_server_t *qd_server)
 {
     pn_driver_t     *driver   = qd_server->driver;
-    pn_listener_t   *listener = pn_driver_listener(driver);
+    pn_listener_t   *listener;
     pn_connector_t  *cxtr;
     qd_connection_t *ctx;
 
-    while (listener) {
+    for (listener = pn_driver_listener(driver); listener; listener = pn_driver_listener(driver))
{
         cxtr = pn_listener_accept(listener);
+        if (!cxtr)
+            continue;
+
         qd_log(qd_server->log_source, QD_LOG_TRACE, "Accepting Connection from %s", pn_connector_name(cxtr));
         ctx = new_qd_connection_t();
         DEQ_ITEM_INIT(ctx);
@@ -135,7 +138,6 @@ static void thread_process_listeners(qd_
         pn_sasl_done(sasl, PN_SASL_OK);  // TODO - This needs to go away
 
         pn_connector_set_context(cxtr, ctx);
-        listener = pn_driver_listener(driver);
     }
 }
 
@@ -933,6 +935,9 @@ qd_listener_t *qd_server_listen(qd_dispa
 
 void qd_server_listener_free(qd_listener_t* li)
 {
+    if (!li)
+        return;
+
     pn_listener_free(li->pn_listener);
     free_qd_listener_t(li);
 }
@@ -970,6 +975,9 @@ void qd_server_connector_free(qd_connect
     // Don't free the proton connector.  This will be done by the connector
     // processing/cleanup.
 
+    if (!ct)
+        return;
+
     if (ct->ctx) {
         pn_connector_close(ct->ctx->pn_cxtr);
         ct->ctx->connector = 0;



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message