Browse Source

presence: Fix memory leak in DB code

Phil Lavin 9 năm trước cách đây
mục cha
commit
0c36c1b62e
1 tập tin đã thay đổi với 4 bổ sung2 xóa
  1. 4 2
      modules/presence/presentity.c

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