Module: kamailio
Branch: master
Commit: 401838544fde5a11fbdf2b17f21a59ca34cc3db2
URL:
https://github.com/kamailio/kamailio/commit/401838544fde5a11fbdf2b17f21a59c…
Author: Hugh Waite <hughw273(a)gmail.com>
Committer: Hugh Waite <hughw273(a)gmail.com>
Date: 2018-03-01T20:57:27Z
sqlops: sqlops_do_query - Make result parameter optional in C API
- The sqlops_do_query wrapper function will fail if the 'sres' string parameter is
NULL
- This change prevents a NULL string parameter from causing an error.
- The sql_do_query function already handles NULL parameters correctly.
---
Modified: src/modules/sqlops/sql_api.c
---
Diff:
https://github.com/kamailio/kamailio/commit/401838544fde5a11fbdf2b17f21a59c…
Patch:
https://github.com/kamailio/kamailio/commit/401838544fde5a11fbdf2b17f21a59c…
---
diff --git a/src/modules/sqlops/sql_api.c b/src/modules/sqlops/sql_api.c
index 16492300bc..825f77602a 100644
--- a/src/modules/sqlops/sql_api.c
+++ b/src/modules/sqlops/sql_api.c
@@ -703,8 +703,7 @@ int sqlops_do_query(str *scon, str *squery, str *sres)
LM_ERR("invalid connection [%.*s]\n", scon->len, scon->s);
goto error;
}
- res = sql_get_result(sres);
- if(res==NULL)
+ if (sres && ((res = sql_get_result(sres)) == NULL))
{
LM_ERR("invalid result [%.*s]\n", sres->len, sres->s);
goto error;