Looking at the final products from the equation, I think the reaction mechanism may be somewhat similar to the reactions of primary amines with nitrous acid
So if that's the case, then the mechanism would be something like this:
Reagent: sodium nitrite, NaNO2 + HCl (aq)
Since the diazonium salts is not stable, it decomposes readily to form nitrogen gas and a carbocation.
The carbocation then reacts with water to give the carboxylic acid.
Overall equation:
I am not really certain, so do correct me if i am wrong.