DRILL-1020: Fix bug in dynamic allocation