mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 08:36:30 +00:00
Fix a possible double free that would cause a segfault in
checkNodeConfiguration()
This commit is contained in:
committed by
Jaime Casanova
parent
158214acae
commit
c983fdf83c
@@ -101,7 +101,7 @@ bool
|
|||||||
is_witness(PGconn *conn, char *schema, char *cluster, int node_id)
|
is_witness(PGconn *conn, char *schema, char *cluster, int node_id)
|
||||||
{
|
{
|
||||||
PGresult *res;
|
PGresult *res;
|
||||||
bool result;
|
bool result = false;
|
||||||
char sqlquery[QUERY_STR_LEN];
|
char sqlquery[QUERY_STR_LEN];
|
||||||
|
|
||||||
sqlquery_snprintf(sqlquery, "SELECT witness from %s.repl_nodes where cluster = '%s' and id = %d",
|
sqlquery_snprintf(sqlquery, "SELECT witness from %s.repl_nodes where cluster = '%s' and id = %d",
|
||||||
@@ -115,9 +115,7 @@ is_witness(PGconn *conn, char *schema, char *cluster, int node_id)
|
|||||||
exit(ERR_DB_QUERY);
|
exit(ERR_DB_QUERY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(PQgetvalue(res, 0, 0), "f") == 0)
|
if (PQntuples(res) == 1 && strcmp(PQgetvalue(res, 0, 0), "t") == 0)
|
||||||
result = false;
|
|
||||||
else
|
|
||||||
result = true;
|
result = true;
|
||||||
|
|
||||||
PQclear(res);
|
PQclear(res);
|
||||||
|
|||||||
Reference in New Issue
Block a user