mirror of https://git.kore.io/kore.git
pgsql improvements
* set pgsql->result to NULL when we freed it * drain the connection pipe just in case in pgsql_conn_release()
This commit is contained in:
parent
0b3c918ba6
commit
f021c8db44
|
@ -147,8 +147,10 @@ kore_pgsql_continue(struct http_request *req, struct kore_pgsql *pgsql)
|
||||||
pgsql->error = NULL;
|
pgsql->error = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pgsql->result)
|
if (pgsql->result) {
|
||||||
PQclear(pgsql->result);
|
PQclear(pgsql->result);
|
||||||
|
pgsql->result = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
switch (pgsql->state) {
|
switch (pgsql->state) {
|
||||||
case KORE_PGSQL_STATE_INIT:
|
case KORE_PGSQL_STATE_INIT:
|
||||||
|
@ -246,6 +248,10 @@ pgsql_conn_release(struct kore_pgsql *pgsql)
|
||||||
kore_mem_free(pgsql->conn->job->query);
|
kore_mem_free(pgsql->conn->job->query);
|
||||||
kore_mem_free(pgsql->conn->job);
|
kore_mem_free(pgsql->conn->job);
|
||||||
|
|
||||||
|
/* Drain just in case. */
|
||||||
|
while (PQgetResult(pgsql->conn->db) != NULL)
|
||||||
|
;
|
||||||
|
|
||||||
pgsql->conn->job = NULL;
|
pgsql->conn->job = NULL;
|
||||||
pgsql->conn->flags |= PGSQL_CONN_FREE;
|
pgsql->conn->flags |= PGSQL_CONN_FREE;
|
||||||
TAILQ_INSERT_TAIL(&pgsql_conn_free, pgsql->conn, list);
|
TAILQ_INSERT_TAIL(&pgsql_conn_free, pgsql->conn, list);
|
||||||
|
|
Loading…
Reference in New Issue