Fix memory leak in RemoteFinalizedShardPlacementList().

support-6.1-cancellation-fix
Andres Freund 2017-06-30 18:20:54 -07:00 committed by Metin Doslu
parent 57c529c3b0
commit 4f78e4432d
1 changed files with 3 additions and 2 deletions

View File

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