summaryrefslogtreecommitdiff
path: root/lib/init.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2009-02-20 10:56:52 +0000
committerJean Delvare <khali@linux-fr.org>2009-02-20 10:56:52 +0000
commitc1a066a3075f4f93e40dd53d2c656c2c7ea1d1a0 (patch)
tree51ca36ba7d4469c1fd27c6f4f9b855ba7d602d6d /lib/init.c
parent0bc948ca6a9ec979fca46604b2649540652bedba (diff)
downloadlm-sensors-git-c1a066a3075f4f93e40dd53d2c656c2c7ea1d1a0.tar.gz
If str(n)dup fails, there is no more memory left. We should exit with
"Out of memory". Patch from Andre Prendel. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5661 7894878c-1315-0410-8ee3-d5d059ff63e0
Diffstat (limited to 'lib/init.c')
-rw-r--r--lib/init.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/init.c b/lib/init.c
index b5a98c3f..d0c7a5c2 100644
--- a/lib/init.c
+++ b/lib/init.c
@@ -53,6 +53,9 @@ static int sensors_parse(void)
locale = setlocale(LC_ALL, NULL);
if (locale) {
locale = strdup(locale);
+ if (!locale)
+ sensors_fatal_error(__func__, "Out of memory");
+
setlocale(LC_ALL, "C");
}