diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-06-08 17:59:21 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-06-08 17:59:21 -0700 |
| commit | 765a39a398dfacbc029c91e1b6b1d5e74a5f5e9f (patch) | |
| tree | 4356c8c22f897e1268cc28c94e7fb609fc68ae34 /src/core | |
| parent | da41431d78fc48a1650588e7d87a76868358c5fd (diff) | |
| download | nng-765a39a398dfacbc029c91e1b6b1d5e74a5f5e9f.tar.gz nng-765a39a398dfacbc029c91e1b6b1d5e74a5f5e9f.tar.bz2 nng-765a39a398dfacbc029c91e1b6b1d5e74a5f5e9f.zip | |
Copy reference counts when resizing!
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/objhash.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/objhash.c b/src/core/objhash.c index 8578307c..94c42dcf 100644 --- a/src/core/objhash.c +++ b/src/core/objhash.c @@ -222,6 +222,8 @@ nni_objhash_resize(nni_objhash *oh, int grow) oh->oh_load++; newnodes[index].on_val = oldnodes[i].on_val; newnodes[index].on_id = oldnodes[i].on_id; + newnodes[index].on_refcnt = + oldnodes[i].on_refcnt; break; } newnodes[index].on_skips++; @@ -252,6 +254,8 @@ nni_objhash_unref(nni_objhash *oh, uint32_t id) NNI_ASSERT(node != NULL); val = node->on_val; + NNI_ASSERT(node->on_refcnt > 0); + NNI_ASSERT(node->on_refcnt < 1000000); // reasonable limit, debug only node->on_refcnt--; if (node->on_refcnt != 0) { if (node->on_refcnt == 1) { |
