Module: kamailio
Branch: 4.2
Commit: 29e6386a140ccc4025e2ff98ad8a3b0d5da1b6c3
URL: 
https://github.com/kamailio/kamailio/commit/29e6386a140ccc4025e2ff98ad8a3b0d5da1b6c3

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2015-02-04T18:07:45+01:00

lib/srdb1: init columns array to 0

- allows proper cleanup if there is an error while filling the items

(cherry picked from commit e59db798b84f1641f807d216c2ca460cfedb31e7)

---

Modified: lib/srdb1/db_res.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/29e6386a140ccc4025e2ff98ad8a3b0d5da1b6c3.diff
Patch: 
https://github.com/kamailio/kamailio/commit/29e6386a140ccc4025e2ff98ad8a3b0d5da1b6c3.patch

---

diff --git a/lib/srdb1/db_res.c b/lib/srdb1/db_res.c
index 1a775ca..ca7b128 100644
--- a/lib/srdb1/db_res.c
+++ b/lib/srdb1/db_res.c
@@ -150,6 +150,7 @@ int db_allocate_columns(db1_res_t* _r, const unsigned int 
cols)
                LM_ERR("no private memory left\n");
                return -1;
        }
+       memset(RES_NAMES(_r), 0, sizeof(db_key_t) * cols);
        LM_DBG("allocate %d bytes for result names at %p\n",
                (int)(sizeof(db_key_t) * cols),
                RES_NAMES(_r));
@@ -160,6 +161,7 @@ int db_allocate_columns(db1_res_t* _r, const unsigned int 
cols)
                pkg_free(RES_NAMES(_r));
                return -1;
        }
+       memset(RES_TYPES(_r), 0, sizeof(db_type_t) * cols);
        LM_DBG("allocate %d bytes for result types at %p\n",
                (int)(sizeof(db_type_t) * cols),
                RES_TYPES(_r));


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to