mirror of https://github.com/citusdata/citus.git
Make sure to clear PGresult on few places
This leads to a memory leak otherwise.pull/2618/head
parent
bf9a119b6f
commit
26f569abd8
|
@ -237,6 +237,7 @@ DistributedTableSizeOnWorker(WorkerNode *workerNode, Oid relationId, char *sizeQ
|
||||||
tableSizeString = tableSizeStringInfo->data;
|
tableSizeString = tableSizeStringInfo->data;
|
||||||
tableSize = atol(tableSizeString);
|
tableSize = atol(tableSizeString);
|
||||||
|
|
||||||
|
PQclear(result);
|
||||||
ClearResults(connection, raiseErrors);
|
ClearResults(connection, raiseErrors);
|
||||||
|
|
||||||
return tableSize;
|
return tableSize;
|
||||||
|
|
|
@ -196,6 +196,7 @@ GetRemoteProcessId(MultiConnection *connection)
|
||||||
StringInfo queryStringInfo = makeStringInfo();
|
StringInfo queryStringInfo = makeStringInfo();
|
||||||
PGresult *result = NULL;
|
PGresult *result = NULL;
|
||||||
int64 rowCount = 0;
|
int64 rowCount = 0;
|
||||||
|
int64 resultValue = 0;
|
||||||
|
|
||||||
appendStringInfo(queryStringInfo, GET_PROCESS_ID);
|
appendStringInfo(queryStringInfo, GET_PROCESS_ID);
|
||||||
|
|
||||||
|
@ -208,7 +209,10 @@ GetRemoteProcessId(MultiConnection *connection)
|
||||||
PG_RETURN_VOID();
|
PG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resultValue = ParseIntField(result, 0, 0);
|
||||||
|
|
||||||
|
PQclear(result);
|
||||||
ClearResults(connection, false);
|
ClearResults(connection, false);
|
||||||
|
|
||||||
return ParseIntField(result, 0, 0);
|
return resultValue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -563,6 +563,7 @@ TableDDLCommandList(const char *nodeName, uint32 nodePort, const char *tableName
|
||||||
ExecuteOptionalRemoteCommand(connection, queryString->data, &result);
|
ExecuteOptionalRemoteCommand(connection, queryString->data, &result);
|
||||||
ddlCommandList = ReadFirstColumnAsText(result);
|
ddlCommandList = ReadFirstColumnAsText(result);
|
||||||
|
|
||||||
|
PQclear(result);
|
||||||
ForgetResults(connection);
|
ForgetResults(connection);
|
||||||
CloseConnection(connection);
|
CloseConnection(connection);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue