You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rh...@apache.org on 2014/12/12 15:27:22 UTC

[2/5] qpid-proton git commit: perform decrefs last

perform decrefs last


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/419abc3a
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/419abc3a
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/419abc3a

Branch: refs/heads/master
Commit: 419abc3a521437692e513810b1dbe91fc09dcb54
Parents: 5dd477a
Author: Rafael Schloming <rh...@alum.mit.edu>
Authored: Thu Dec 11 00:10:40 2014 -0500
Committer: Rafael Schloming <rh...@alum.mit.edu>
Committed: Fri Dec 12 08:21:45 2014 -0500

----------------------------------------------------------------------
 proton-c/src/object/map.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/419abc3a/proton-c/src/object/map.c
----------------------------------------------------------------------
diff --git a/proton-c/src/object/map.c b/proton-c/src/object/map.c
index fc98116..1a758a1 100644
--- a/proton-c/src/object/map.c
+++ b/proton-c/src/object/map.c
@@ -169,6 +169,13 @@ static bool pni_map_ensure(pn_map_t *map, size_t capacity)
       void *key = entries[i].key;
       void *value = entries[i].value;
       pn_map_put(map, key, value);
+    }
+  }
+
+  for (size_t i = 0; i < oldcap; i++) {
+    if (entries[i].state != PNI_ENTRY_FREE) {
+      void *key = entries[i].key;
+      void *value = entries[i].value;
       pn_class_decref(map->key, key);
       pn_class_decref(map->value, value);
     }
@@ -242,9 +249,10 @@ int pn_map_put(pn_map_t *map, void *key, void *value)
 {
   assert(map);
   pni_entry_t *entry = pni_map_entry(map, key, NULL, true);
-  pn_class_decref(map->value, entry->value);
+  void *dref_val = entry->value;
   entry->value = value;
   pn_class_incref(map->value, value);
+  pn_class_decref(map->value, dref_val);
   return 0;
 }
 


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