Fix memory leak in RemoteFinalizedShardPlacementList().

pull/1473/head
Andres Freund 2017-06-30 18:20:54 -07:00
parent c161c2fbe3
commit 3dedeadb5e
1 changed files with 3 additions and 2 deletions

View File

@ -939,8 +939,8 @@ RemoteFinalizedShardPlacementList(uint64 shardId)
for (rowIndex = 0; rowIndex < rowCount; rowIndex++)
{
char *placementIdString = PQgetvalue(queryResult, rowIndex, 0);
char *nodeName = PQgetvalue(queryResult, rowIndex, 1);
char *nodePortString = PQgetvalue(queryResult, rowIndex, 2);
char *nodeName = pstrdup(PQgetvalue(queryResult, rowIndex, 1));
char *nodePortString = pstrdup(PQgetvalue(queryResult, rowIndex, 2));
uint32 nodePort = atoi(nodePortString);
uint64 placementId = atoll(placementIdString);
@ -959,6 +959,7 @@ RemoteFinalizedShardPlacementList(uint64 shardId)
ereport(ERROR, (errmsg("could not get shard placements from the master node")));
}
PQclear(queryResult);
return finalizedPlacementList;
}