Unify tune modify

First step to integrate "modify" functionality into "tune".
- fixes setlocale caused double-free problems 
- assorted memory management changes
- code cleanups in rrd_tune