Originally Posted by
matsp
And if we give you the correct answers, you will get the job? Or are you just hoping that me telling you that the malloc in the above is wrong, you will automatically be able to recognise such a scenario in another piece of code? Assuming of course that the malloc is actually wrong, which I'm not by any means saying it is, because I think you need to think about what the code does and see if you can figure out what is wrong.
Without knowing what the preconditions are (such as, do we know anything about the strings a and b that we can use in the code), I can spot at least 3 potential bugs.
--
Mats