Explorar o código

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

- db result and columns in the query are allocated
Daniel-Constantin Mierla %!s(int64=9) %!d(string=hai) anos
pai
achega
7289417c39
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      modules/presence/presentity.c

+ 4 - 2
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++)