Author: rhs
Date: Thu Jun 19 17:22:01 2014
New Revision: 1603950

URL: http://svn.apache.org/r1603950
Log:
check that finalize did not create a new ref

Modified:
    qpid/proton/trunk/proton-c/src/object/object.c

Modified: qpid/proton/trunk/proton-c/src/object/object.c
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/object/object.c?rev=1603950&r1=1603949&r2=1603950&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/object/object.c (original)
+++ qpid/proton/trunk/proton-c/src/object/object.c Thu Jun 19 17:22:01 2014
@@ -70,7 +70,11 @@ void pn_decref(void *object)
     head->refcount--;
     if (!head->refcount) {
       pn_finalize(object);
-      free(head);
+      // Check the refcount again in case finalize created a new
+      // reference.
+      if (!head->refcount) {
+        free(head);
+      }
     }
   }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to