Avoid memory leak if configuration is invalid

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>