You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/1014
-- Commit Summary --
* db_text : fix memory allocation * db_text : less intrusive log * db_text : split db_print routines * db_text : add rpc command for live query
-- File Changes --
M src/modules/db_text/db_text.c (78) M src/modules/db_text/dbt_base.c (1) M src/modules/db_text/dbt_file.c (302) M src/modules/db_text/dbt_lib.c (2) M src/modules/db_text/dbt_lib.h (5) M src/modules/db_text/dbt_raw_query.c (44)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/1014.patch https://github.com/kamailio/kamailio/pull/1014.diff
miconda commented on this pull request.
@@ -117,15 +117,22 @@ int dbt_raw_query_select(db1_con_t* _h, str* _s, db1_res_t** _r)
result_cols = pkg_malloc(sizeof(db_key_t) * cols); memset(result_cols, 0, sizeof(db_key_t) * cols); for(n=0; n < cols; n++) { - result_cols[n] = &_tbc->colv[n]->name; + result_cols[n] = pkg_malloc(sizeof(str));
The result of mallocs are not checked if there is a valid pointer or NULL, which can happen on not enough memory available.
@lazedo pushed 1 commit.
99c82e0 db_text : check allocated memory
@lazedo pushed 1 commit.
8b017cc db_text : fix typo
@lazedo pushed 1 commit.
f49200b db_text : add documentation for db_text.query
Thanks, it can be merged!
Merged #1014.