summaryrefslogtreecommitdiff
path: root/src/lib/rib.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@ugent.be>2017-04-20 12:32:13 +0000
committerSander Vrijders <sander.vrijders@ugent.be>2017-04-20 12:32:13 +0000
commita3048addc6a6f4284ade5c024ae42db5719f509a (patch)
tree8fadc92571a89e9226185562fee49fc1f78b93da /src/lib/rib.c
parent3ef1c232ee5a25e0de2dcade0c7f07bd3ae6f628 (diff)
parent2a802888e91a274fa49d341da7744ea9c386b150 (diff)
downloadouroboros-a3048addc6a6f4284ade5c024ae42db5719f509a.tar.gz
ouroboros-a3048addc6a6f4284ade5c024ae42db5719f509a.zip
Merged in dstaesse/ouroboros/be-rib-lock (pull request #488)
lib: Fix bad lock in rib
Diffstat (limited to 'src/lib/rib.c')
-rw-r--r--src/lib/rib.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/rib.c b/src/lib/rib.c
index 2645e90b..e59e0d94 100644
--- a/src/lib/rib.c
+++ b/src/lib/rib.c
@@ -1407,16 +1407,17 @@ int rib_unpack(uint8_t * packed,
ret = rnode_unpack(msg, root, flags);
- pthread_rwlock_unlock(&rib.lock);
-
if (ret == 0 && msg->has_hash) {
root = rnode_get_child(root, msg->name);
if (memcmp(msg->hash.data, root->sha3, SHA3_256_HASH_LEN)) {
ro_msg__free_unpacked(msg, NULL);
+ pthread_rwlock_unlock(&rib.lock);
return -EFAULT;
}
}
+ pthread_rwlock_unlock(&rib.lock);
+
ro_msg__free_unpacked(msg, NULL);
free(packed);