converting malloc to vector