Module: sip-router Branch: master Commit: da199e1978313b39553e9fb62012fe55cfd186d8 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=da199e19...
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; }