From 0cba8b39c3552d69ea1eb8c4b31edb6a70dd1e6e Mon Sep 17 00:00:00 2001 From: Michael Jerris <mike@jerris.com> Date: Mon, 28 Apr 2014 15:12:02 -0400 Subject: [PATCH] improve error checking for null path --- src/switch_config.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/switch_config.c b/src/switch_config.c index 93fcfad7ad..143d7eb34f 100644 --- a/src/switch_config.c +++ b/src/switch_config.c @@ -39,6 +39,10 @@ SWITCH_DECLARE(int) switch_config_open_file(switch_config_t *cfg, char *file_pat char *path = NULL; char path_buf[1024]; + if (!file_path) { + return 0; + } + if (switch_is_file_path(file_path)) { path = file_path; } else { @@ -69,7 +73,7 @@ SWITCH_DECLARE(int) switch_config_open_file(switch_config_t *cfg, char *file_pat switch_set_string(cfg->path, path); while (switch_config_next_pair(cfg, &var, &val)) { - if (file_path && (cfg->sectno != last) && !strcmp(cfg->section, file_path)) { + if ((cfg->sectno != last) && !strcmp(cfg->section, file_path)) { cfg->lockto = cfg->sectno; return 1; }