[sr-dev] git:master:7289417c: presence: free db result when get_dialog_state() retrieves no rows

Daniel-Constantin Mierla miconda at gmail.com
Mon Sep 19 20:58:44 CEST 2016


Module: kamailio
Branch: master
Commit: 7289417c39939f61ea116fe8dc8d23cdea6401be
URL: https://github.com/kamailio/kamailio/commit/7289417c39939f61ea116fe8dc8d23cdea6401be

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-09-19T20:58:31+02:00

presence: free db result when get_dialog_state() retrieves no rows

- db result and columns in the query are allocated

---

Modified: modules/presence/presentity.c

---

Diff:  https://github.com/kamailio/kamailio/commit/7289417c39939f61ea116fe8dc8d23cdea6401be.diff
Patch: https://github.com/kamailio/kamailio/commit/7289417c39939f61ea116fe8dc8d23cdea6401be.patch

---

diff --git a/modules/presence/presentity.c b/modules/presence/presentity.c
index b5d7b65..d81b90e 100644
--- a/modules/presence/presentity.c
+++ b/modules/presence/presentity.c
@@ -503,9 +503,11 @@ int get_dialog_state(presentity_t* presentity, char** state)
 	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