mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-08-31 06:15:15 +00:00
Fix sensors segfault on bus freeing (sysfs).
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2111 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
12
lib/proc.c
12
lib/proc.c
@@ -213,17 +213,23 @@ int sensors_read_proc_bus(void)
|
|||||||
entry.adapter=strdup(x);
|
entry.adapter=strdup(x);
|
||||||
if(!strncmp(x, "ISA ", 4)) {
|
if(!strncmp(x, "ISA ", 4)) {
|
||||||
entry.number = SENSORS_CHIP_NAME_BUS_ISA;
|
entry.number = SENSORS_CHIP_NAME_BUS_ISA;
|
||||||
entry.algorithm = "ISA bus algorithm";
|
entry.algorithm = strdup("ISA bus algorithm");
|
||||||
} else if(!sscanf(de->d_name, "i2c-%d", &entry.number)) {
|
} else if(!sscanf(de->d_name, "i2c-%d", &entry.number)) {
|
||||||
entry.number = SENSORS_CHIP_NAME_BUS_DUMMY;
|
entry.number = SENSORS_CHIP_NAME_BUS_DUMMY;
|
||||||
entry.algorithm = "Dummy bus algorithm";
|
entry.algorithm = strdup("Dummy bus algorithm");
|
||||||
} else
|
} else
|
||||||
entry.algorithm = "Unavailable from sysfs";
|
entry.algorithm = strdup("Unavailable from sysfs");
|
||||||
|
if (entry.algorithm == NULL)
|
||||||
|
goto FAT_ERROR_SYS;
|
||||||
add_proc_bus(&entry);
|
add_proc_bus(&entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
return 0;
|
return 0;
|
||||||
|
FAT_ERROR_SYS:
|
||||||
|
sensors_fatal_error("sensors_read_proc_bus", "Allocating entry");
|
||||||
|
closedir(dir);
|
||||||
|
return -SENSORS_ERR_PROC;
|
||||||
}
|
}
|
||||||
|
|
||||||
proc:
|
proc:
|
||||||
|
Reference in New Issue
Block a user