Fix memory leaks in service callbacks

:Release Notes:
Free parsed JSON objects always.
Use header file as template instead of source files.

:Detailed Notes:
Template files should always be as small as possible to simplify
development. This commit introduces defines.h.in, which contains
build-specific definitions.
It also fixes spotted memory leaks.

:Testing Performed:
Built successfully. Run WebOS under emulator.

:QA Notes:

:Issues Addressed:

Open-webOS-DCO-1.0-Signed-off-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>

Change-Id: I63389147407eb37e7e7e906e308143a1e077971c
Reviewed-on: https://g2g.palm.com/2941
Tested-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
Reviewed-by: Keith Derrick <keith.derrick@lge.com>
Reviewed-by: Build Verification
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>