Module: sip-router
Branch: master
Commit: 4d99664a9bad77988ee7b8b386820d41fa919a6d
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4d99664…
Author: Richard Fuchs <rfuchs(a)sipwise.com>
Committer: Andreas Granig <agranig(a)sipwise.com>
Date: Fri Apr 20 14:06:38 2012 +0200
htable(k): Fix stale lock on errors.
---
modules_k/htable/htable.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/modules_k/htable/htable.c b/modules_k/htable/htable.c
index 58e9755..66bde1c 100644
--- a/modules_k/htable/htable.c
+++ b/modules_k/htable/htable.c
@@ -519,7 +519,7 @@ static void htable_rpc_dump(rpc_t* rpc, void* c)
if (rpc->add(c, "{", &th) < 0)
{
rpc->fault(c, 500, "Internal error creating rpc");
- return;
+ goto error;
}
if(rpc->struct_add(th, "dd{",
"entry", i,
@@ -527,7 +527,7 @@ static void htable_rpc_dump(rpc_t* rpc, void* c)
"slot", &ih)<0)
{
rpc->fault(c, 500, "Internal error creating rpc");
- return;
+ goto error;
}
while(it)
{
@@ -535,7 +535,7 @@ static void htable_rpc_dump(rpc_t* rpc, void* c)
"item", &vh)<0)
{
rpc->fault(c, 500, "Internal error creating rpc");
- return;
+ goto error;
}
if(it->flags&AVP_VAL_STR) {
if(rpc->struct_add(vh, "SS",
@@ -543,7 +543,7 @@ static void htable_rpc_dump(rpc_t* rpc, void* c)
"value", &it->value.s)<0)
{
rpc->fault(c, 500, "Internal error adding item");
- return;
+ goto error;
}
} else {
if(rpc->struct_add(vh, "Sd",
@@ -551,7 +551,7 @@ static void htable_rpc_dump(rpc_t* rpc, void* c)
"value", (int)it->value.n))
{
rpc->fault(c, 500, "Internal error adding item");
- return;
+ goto error;
}
}
it = it->next;
@@ -559,6 +559,11 @@ static void htable_rpc_dump(rpc_t* rpc, void* c)
}
lock_release(&ht->entries[i].lock);
}
+
+ return;
+
+error:
+ lock_release(&ht->entries[i].lock);
}
rpc_export_t htable_rpc[] = {