Fix reallocation of D buffer in gemm