Module: kamailio
Branch: master
Commit: 474fa9dffd60058cfaad8362d96f0d65ed5f828b
URL:
https://github.com/kamailio/kamailio/commit/474fa9dffd60058cfaad8362d96f0d6…
Author: grumvalski <federico.cabiddu(a)gmail.com>
Committer: grumvalski <federico.cabiddu(a)gmail.com>
Date: 2018-09-28T14:36:14+02:00
async,db_mysql,db_unixodbc: return -1 and free memory if sending task to the async worker
fails
---
Modified: src/modules/async/async_sleep.c
Modified: src/modules/db_mysql/km_dbase.c
Modified: src/modules/db_unixodbc/dbase.c
---
Diff:
https://github.com/kamailio/kamailio/commit/474fa9dffd60058cfaad8362d96f0d6…
Patch:
https://github.com/kamailio/kamailio/commit/474fa9dffd60058cfaad8362d96f0d6…
---
diff --git a/src/modules/async/async_sleep.c b/src/modules/async/async_sleep.c
index 66de747f07..097237f4c0 100644
--- a/src/modules/async/async_sleep.c
+++ b/src/modules/async/async_sleep.c
@@ -298,6 +298,11 @@ int async_send_task(sip_msg_t *msg, cfg_action_t *act, str *cbname)
atp->cbname[cbname->len] = '\0';
atp->cbname_len = cbname->len;
}
- async_task_push(at);
+
+ if (async_task_push(at)<0) {
+ shm_free(at);
+ return -1;
+ }
+
return 0;
}
diff --git a/src/modules/db_mysql/km_dbase.c b/src/modules/db_mysql/km_dbase.c
index 693d510bcf..ad02746c67 100644
--- a/src/modules/db_mysql/km_dbase.c
+++ b/src/modules/db_mysql/km_dbase.c
@@ -186,7 +186,10 @@ int db_mysql_submit_query_async(const db1_con_t* _h, const str* _s)
p[1].len = _s->len;
strncpy(p[1].s, _s->s, _s->len);
- async_task_push(atask);
+ if (async_task_push(atask)<0) {
+ shm_free(atask);
+ return -1;
+ }
return 0;
}
diff --git a/src/modules/db_unixodbc/dbase.c b/src/modules/db_unixodbc/dbase.c
index a7b2c61901..5ebe9c3b0b 100644
--- a/src/modules/db_unixodbc/dbase.c
+++ b/src/modules/db_unixodbc/dbase.c
@@ -227,7 +227,11 @@ int db_unixodbc_submit_query_async(const db1_con_t* _h, const str*
_s)
p[1].len = _s->len;
strncpy(p[1].s, _s->s, _s->len);
- async_task_push(atask);
+
+ if (async_task_push(atask)<0) {
+ shm_free(atask);
+ return -1;
+ }
return 0;
}