Previous attempts to fix this leak didn't identify the root cause, and
ultimately failed. The cause is actually the CPU_UP_PREPARE case
(re)initialising ts->heap back to dummy_heap, which leaks the previous
allocation.
Rearrange the logic to only initialise ts once. This also avoids the
redundant (but benign, due to ts->inactive always being empty) initialising of
the other ts fields.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
switch ( action )
{
case CPU_UP_PREPARE:
- INIT_LIST_HEAD(&ts->inactive);
- spin_lock_init(&ts->lock);
- ts->heap = dummy_heap;
+ /* Only initialise ts once. */
+ if ( !ts->heap )
+ {
+ INIT_LIST_HEAD(&ts->inactive);
+ spin_lock_init(&ts->lock);
+ ts->heap = dummy_heap;
+ }
break;
case CPU_UP_CANCELED: