Merge "hwc: Fix to avoid heap corruption"