Skip to content

Commit

Permalink
Free tuple after use (#29)
Browse files Browse the repository at this point in the history
refresh_rejectmap looks for a tuple using SearchSysCacheCopy1 which retrieves
a copy of the tuple allocating memory for it. However, refresh_rejectmap didn't
free these tuple copies after use. If lots of oids were passed, diskquota could
work incorrectly because of huge memory leak. This patch frees these tuples and
prevents memory leaks.
  • Loading branch information
Dennis Kovalenko authored Dec 27, 2023
1 parent 5e402a7 commit e30e01c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/quotamodel.c
Original file line number Diff line number Diff line change
Expand Up @@ -2047,6 +2047,8 @@ refresh_rejectmap(PG_FUNCTION_ARGS)
memcpy(&blocked_filenode_entry->auxblockinfo, &keyitem, sizeof(RejectMapEntry));
blocked_filenode_entry->segexceeded = rejectmapentry->segexceeded;
}

heap_freetuple(curr_tuple);
}
}
/*
Expand All @@ -2056,6 +2058,8 @@ refresh_rejectmap(PG_FUNCTION_ARGS)
break;
}
}

heap_freetuple(tuple);
}
else
{
Expand Down

0 comments on commit e30e01c

Please sign in to comment.