[sr-dev] git:master:33228bba: db_berkeley: reset lkey to avoid double free

Daniel-Constantin Mierla miconda at gmail.com
Thu May 5 19:52:42 CEST 2022


Module: kamailio
Branch: master
Commit: 33228bba33a6ea2e2d9a7acd9a240929223b9d39
URL: https://github.com/kamailio/kamailio/commit/33228bba33a6ea2e2d9a7acd9a240929223b9d39

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-05-05T19:52:11+02:00

db_berkeley: reset lkey to avoid double free

---

Modified: src/modules/db_berkeley/db_berkeley.c

---

Diff:  https://github.com/kamailio/kamailio/commit/33228bba33a6ea2e2d9a7acd9a240929223b9d39.diff
Patch: https://github.com/kamailio/kamailio/commit/33228bba33a6ea2e2d9a7acd9a240929223b9d39.patch

---

diff --git a/src/modules/db_berkeley/db_berkeley.c b/src/modules/db_berkeley/db_berkeley.c
index 80c9aefac0..a8fe812c50 100644
--- a/src/modules/db_berkeley/db_berkeley.c
+++ b/src/modules/db_berkeley/db_berkeley.c
@@ -1055,8 +1055,10 @@ int bdb_update(db1_con_t *_con, db_key_t *_k, db_op_t *_op, db_val_t *_v,
 		goto cleanup;
 	}
 
-	if(lkey)
+	if(lkey) {
 		pkg_free(lkey);
+		lkey = NULL;
+	}
 
 	key.data = kbuf;
 	key.ulen = MAX_ROW_SIZE;




More information about the sr-dev mailing list