sunos: fix free() of non-malloc'd pointer
This commit is contained in:
parent
431d61af31
commit
d0816aae52
@ -332,14 +332,6 @@ uv_err_t uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
|
||||
lookup_instance = 0;
|
||||
while ((ksp = kstat_lookup(kc, (char *)"cpu_info", lookup_instance, NULL))) {
|
||||
if (kstat_read(kc, ksp, NULL) == -1) {
|
||||
/*
|
||||
* It is deeply annoying, but some kstats can return errors
|
||||
* under otherwise routine conditions. (ACPI is one
|
||||
* offender; there are surely others.) To prevent these
|
||||
* fouled kstats from completely ruining our day, we assign
|
||||
* an "error" member to the return value that consists of
|
||||
* the strerror().
|
||||
*/
|
||||
cpu_info->speed = 0;
|
||||
cpu_info->model = NULL;
|
||||
} else {
|
||||
@ -349,7 +341,7 @@ uv_err_t uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
|
||||
|
||||
knp = (kstat_named_t *) kstat_data_lookup(ksp, (char *)"brand");
|
||||
assert(knp->data_type == KSTAT_DATA_STRING);
|
||||
cpu_info->model = KSTAT_NAMED_STR_PTR(knp);
|
||||
cpu_info->model = strdup(KSTAT_NAMED_STR_PTR(knp));
|
||||
}
|
||||
|
||||
lookup_instance++;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user