Module: kamailio
Branch: master
Commit: ba9f2b5af9cabd61f67ceedb8feab6bd7bc6526d
URL:
https://github.com/kamailio/kamailio/commit/ba9f2b5af9cabd61f67ceedb8feab6b…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-04-05T12:02:20+02:00
core: init allocated memory in str_hash_alloc()
- removed unused pointer shifting in dset.c
- small reworking of lval_assign()
---
Modified: src/core/dset.c
Modified: src/core/lvalue.c
Modified: src/core/str_hash.h
---
Diff:
https://github.com/kamailio/kamailio/commit/ba9f2b5af9cabd61f67ceedb8feab6b…
Patch:
https://github.com/kamailio/kamailio/commit/ba9f2b5af9cabd61f67ceedb8feab6b…
---
diff --git a/src/core/dset.c b/src/core/dset.c
index adabe7bba0..b6999f32b5 100644
--- a/src/core/dset.c
+++ b/src/core/dset.c
@@ -860,7 +860,6 @@ int msg_get_src_addr(sip_msg_t *msg, str *uri, int mode)
p += TRANSPORT_PARAM_LEN;
memcpy(p, proto.s, proto.len);
- p += proto.len;
}
uri->s = buf;
diff --git a/src/core/lvalue.c b/src/core/lvalue.c
index ab600c04bb..5d779cfbce 100644
--- a/src/core/lvalue.c
+++ b/src/core/lvalue.c
@@ -380,7 +380,7 @@ int lval_assign(struct run_act_ctx* h, struct sip_msg* msg,
struct rvalue* rv;
int ret;
- ret=0;
+ ret=-1;
rv=rval_expr_eval(h, msg, rve);
if (unlikely(rv==0)){
LM_ERR("rval expression evaluation failed (%d,%d-%d,%d)\n",
@@ -404,9 +404,7 @@ int lval_assign(struct run_act_ctx* h, struct sip_msg* msg,
LM_ERR("assignment failed at pos: (%d,%d-%d,%d)\n",
rve->fpos.s_line, rve->fpos.s_col,
rve->fpos.e_line, rve->fpos.e_col);
- }
- else
- {
+ } else {
if(unlikely(_log_assign_action!=NULL))
_log_assign_action(msg, lv);
}
@@ -414,5 +412,5 @@ int lval_assign(struct run_act_ctx* h, struct sip_msg* msg,
return ret;
error:
if (rv) rval_destroy(rv);
- return -1;
+ return ret;
}
diff --git a/src/core/str_hash.h b/src/core/str_hash.h
index 263bb3cd3d..63a041fd29 100644
--- a/src/core/str_hash.h
+++ b/src/core/str_hash.h
@@ -56,7 +56,7 @@ struct str_hash_table{
/* returns 0 on success, <0 on failure */
inline static int str_hash_alloc(struct str_hash_table* ht, int size)
{
- ht->table=(struct str_hash_head*)pkg_malloc(sizeof(struct str_hash_head)*size);
+ ht->table=(struct str_hash_head*)pkg_mallocxz(sizeof(struct str_hash_head)*size);
if (ht->table==0) {
PKG_MEM_ERROR;
return -1;