[sr-dev] git:master:0c36c1b6: presence: Fix memory leak in DB code

Phil Lavin phil at lavin.me.uk
Mon Sep 19 23:04:42 CEST 2016


Module: kamailio
Branch: master
Commit: 0c36c1b62efef176ae6e9322f14096e3a63ed348
URL: https://github.com/kamailio/kamailio/commit/0c36c1b62efef176ae6e9322f14096e3a63ed348

Author: Phil Lavin <phil at lavin.me.uk>
Committer: Phil Lavin <phil at lavin.me.uk>
Date: 2016-09-19T21:27:54+01:00

presence: Fix memory leak in DB code

---

Modified: modules/presence/presentity.c

---

Diff:  https://github.com/kamailio/kamailio/commit/0c36c1b62efef176ae6e9322f14096e3a63ed348.diff
Patch: https://github.com/kamailio/kamailio/commit/0c36c1b62efef176ae6e9322f14096e3a63ed348.patch

---

diff --git a/modules/presence/presentity.c b/modules/presence/presentity.c
index d81b90e..e601153 100644
--- a/modules/presence/presentity.c
+++ b/modules/presence/presentity.c
@@ -396,9 +396,11 @@ int delete_presentity_if_dialog_id_exists(presentity_t* presentity, char* dialog
 	if(result == NULL)
 		return -3;
 
-	// No results from query definitely means no dialog exists
-	if (result->n <= 0)
+	/* no results from query definitely means no dialog exists */
+	if (result->n <= 0) {
+		pa_dbf.free_result(pa_db, result);
 		return 0;
+	}
 
 	// Loop the rows returned from the DB
 	for (i=0; i < result->n; i++)




More information about the sr-dev mailing list