Merge pull request #2618 from citusdata/fix_relation_size_leak

Make sure to clear `PGresult` in missing places
pull/2597/head
Önder Kalacı 2019-03-01 14:44:43 +01:00 committed by GitHub
commit 6594ffafa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

View File

@ -237,6 +237,7 @@ DistributedTableSizeOnWorker(WorkerNode *workerNode, Oid relationId, char *sizeQ
tableSizeString = tableSizeStringInfo->data;
tableSize = atol(tableSizeString);
PQclear(result);
ClearResults(connection, raiseErrors);
return tableSize;

View File

@ -196,6 +196,7 @@ GetRemoteProcessId(MultiConnection *connection)
StringInfo queryStringInfo = makeStringInfo();
PGresult *result = NULL;
int64 rowCount = 0;
int64 resultValue = 0;
appendStringInfo(queryStringInfo, GET_PROCESS_ID);
@ -208,7 +209,10 @@ GetRemoteProcessId(MultiConnection *connection)
PG_RETURN_VOID();
}
resultValue = ParseIntField(result, 0, 0);
PQclear(result);
ClearResults(connection, false);
return ParseIntField(result, 0, 0);
return resultValue;
}

View File

@ -563,6 +563,7 @@ TableDDLCommandList(const char *nodeName, uint32 nodePort, const char *tableName
ExecuteOptionalRemoteCommand(connection, queryString->data, &result);
ddlCommandList = ReadFirstColumnAsText(result);
PQclear(result);
ForgetResults(connection);
CloseConnection(connection);