From: Jaroslav Kysela Date: Sun, 3 May 2015 18:01:06 +0000 (+0200) Subject: config: fix the global config variable initialization on error, fixes #2816 X-Git-Tag: v4.1~71 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6095136b3db6c6a735dc30d519690fff9fed5da;p=thirdparty%2Ftvheadend.git config: fix the global config variable initialization on error, fixes #2816 --- diff --git a/src/config.c b/src/config.c index 34bb15dfe..b5e065562 100644 --- a/src/config.c +++ b/src/config.c @@ -1395,6 +1395,9 @@ config_boot ( const char *path, gid_t gid, uid_t uid ) { struct stat st; char buf[1024]; + htsmsg_t *config2; + + config = htsmsg_create_map(); /* Generate default */ if (!path) { @@ -1438,10 +1441,12 @@ config_boot ( const char *path, gid_t gid, uid_t uid ) tvhwarn("config", "unable to chown lock file %s UID:%d GID:%d", config_lock, uid, gid); /* Load global settings */ - config = hts_settings_load("config"); - if (!config) { + config2 = hts_settings_load("config"); + if (!config2) { tvhlog(LOG_DEBUG, "config", "no configuration, loading defaults"); - config = htsmsg_create_map(); + } else { + htsmsg_destroy(config); + config = config2; } }