summaryrefslogtreecommitdiff
path: root/lib/init.c
diff options
context:
space:
mode:
authorkhali <khali@7894878c-1315-0410-8ee3-d5d059ff63e0>2009-02-26 14:46:47 +0000
committerkhali <khali@7894878c-1315-0410-8ee3-d5d059ff63e0>2009-02-26 14:46:47 +0000
commit8989e53e8c65c55edfa73d0b4283d46961f80dff (patch)
treed9fd50bab07a34459a52e58d806b40368b285949 /lib/init.c
parentc862c004482eba2d6613a362b9432b66b213fd65 (diff)
downloadlm-sensors-8989e53e8c65c55edfa73d0b4283d46961f80dff.tar.gz
Fix segmentation fault when passing a custom configuration file.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5665 7894878c-1315-0410-8ee3-d5d059ff63e0
Diffstat (limited to 'lib/init.c')
-rw-r--r--lib/init.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/init.c b/lib/init.c
index d0c7a5c2..e97f6882 100644
--- a/lib/init.c
+++ b/lib/init.c
@@ -91,11 +91,14 @@ static int parse_config(FILE *input, const char *name)
int err;
char *name_copy;
- /* Record configuration file name for error reporting */
- name_copy = strdup(name);
- if (!name_copy)
- sensors_fatal_error(__func__, "Out of memory");
- sensors_add_config_files(&name_copy);
+ if (name) {
+ /* Record configuration file name for error reporting */
+ name_copy = strdup(name);
+ if (!name_copy)
+ sensors_fatal_error(__func__, "Out of memory");
+ sensors_add_config_files(&name_copy);
+ } else
+ name_copy = NULL;
if (sensors_scanner_init(input, name_copy)) {
err = -SENSORS_ERR_PARSE;