Skip to content

Commit

Permalink
Ported fix for bug CORE-4051 : Memory leak when sorting big records
Browse files Browse the repository at this point in the history
  • Loading branch information
hvlad committed Feb 25, 2013
1 parent 08a4416 commit f05d1bb
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/jrd/sort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2256,6 +2256,11 @@ static void merge_runs(sort_context* scb, USHORT n)
}

run->run_buff_cache = false;
if (run->run_buff_alloc)
{
delete (UCHAR*) run->run_buffer;
run->run_buff_alloc = false;
}
run->run_buffer = NULL;

// Add run descriptor to list of unused run descriptor blocks
Expand All @@ -2265,11 +2270,7 @@ static void merge_runs(sort_context* scb, USHORT n)
}

scb->scb_free_runs = run->run_next;
if (run->run_buff_alloc)
{
delete (UCHAR*) run->run_buffer;
run->run_buff_alloc = false;
}

temp_run.run_header.rmh_type = RMH_TYPE_RUN;
temp_run.run_depth = run->run_depth;
temp_run.run_buff_cache = false;
Expand Down

0 comments on commit f05d1bb

Please sign in to comment.