Просмотр исходного кода

srdb1: fix memory leak in db-id

- When getting an existing connection from the pool, free the newly
  created db-id as the pool connection already has a reference to the
  existing one.  Fixes FS#436
Torrey Searle 11 лет назад
Родитель
Сommit
69de17d3bb
1 измененных файлов с 2 добавлено и 0 удалено
  1. 2 0
      lib/srdb1/db.c

+ 2 - 0
lib/srdb1/db.c

@@ -325,6 +325,8 @@ db1_con_t* db_do_init2(const str* url, void* (*new_connection)(), db_pooling_t p
 		pool_insert((struct pool_con*)con);
 	} else {
 		LM_DBG("connection %p found in pool\n", id);
+		free_db_id(id); // free the new id, as we use the pool instead
+		id = 0;
 	}
 
 	res->tail = (unsigned long)con;