Fix leaks in demos

Discovered a couple of leaks in 2 demos (probably more in the others) which seem to come from a misinterpretation on how memory *should* be handled.

i.e. response value is allocated each time it is used.

Keeping this separate to my hashmap changes to enable interactive review.