[prev in list] [next in list] [prev in thread] [next in thread]
List: sr-dev
Subject: [sr-dev] git:master: pipelimit: moved log messages out of lock
From: Daniel-Constantin Mierla <miconda () gmail ! com>
Date: 2014-04-29 20:53:32
Message-ID: 20140429205332.AFAA7EF8075 () rimmer ! ryngle ! com
[Download RAW message or body]
Module: sip-router
Branch: master
Commit: da199e1978313b39553e9fb62012fe55cfd186d8
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=da199e1978313b39553e9fb62012fe55cfd186d8
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Committer: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Tue Apr 29 21:59:53 2014 +0200
pipelimit: moved log messages out of lock
- free allocated cell if the algorithm is invalid
---
modules/pipelimit/pl_ht.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/modules/pipelimit/pl_ht.c b/modules/pipelimit/pl_ht.c
index f044203..e428644 100644
--- a/modules/pipelimit/pl_ht.c
+++ b/modules/pipelimit/pl_ht.c
@@ -175,8 +175,8 @@ int pl_pipe_add(str *pipeid, str *algorithm, int limit)
(pl_pipe_t*)shm_malloc(sizeof(pl_pipe_t)+(1+pipeid->len)*sizeof(char));
if(cell == NULL)
{
- LM_ERR("cannot create new cell.\n");
lock_release(&_pl_pipes_ht->slots[idx].lock);
+ LM_ERR("cannot create new cell.\n");
return -1;
}
memset(cell, 0, sizeof(pl_pipe_t)+(1+pipeid->len)*sizeof(char));
@@ -189,9 +189,10 @@ int pl_pipe_add(str *pipeid, str *algorithm, int limit)
cell->limit = limit;
if (str_map_str(algo_names, algorithm, &cell->algo))
{
+ lock_release(&_pl_pipes_ht->slots[idx].lock);
+ shm_free(cell);
LM_ERR("cannot find algorithm [%.*s].\n", algorithm->len,
algorithm->s);
- lock_release(&_pl_pipes_ht->slots[idx].lock);
return -1;
}
_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic