Arista Networks interview question

1. Fix the crash and write some function(Coding round)