2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-31 22:35:23 +00:00

Fix a use after free()

The issue was reported by Coverity Scan.

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
This commit is contained in:
Ondřej Lysoněk
2018-05-03 17:28:52 +02:00
committed by Guenter Roeck
parent 1c48b191c8
commit 3b548b74ae

View File

@@ -48,7 +48,6 @@ void print_chip_raw(const sensors_chip_name *name)
continue;
}
printf("%s:\n", label);
free(label);
b = 0;
while ((sub = sensors_get_all_subfeatures(name, feature, &b))) {
@@ -64,6 +63,7 @@ void print_chip_raw(const sensors_chip_name *name)
} else
printf("(%s)\n", label);
}
free(label);
}
}
@@ -86,7 +86,6 @@ void print_chip_json(const sensors_chip_name *name)
if (cnt > 0)
printf(",\n");
printf(" \"%s\":{\n", label);
free(label);
b = 0;
subCnt = 0;
@@ -109,6 +108,7 @@ void print_chip_json(const sensors_chip_name *name)
}
subCnt++;
}
free(label);
printf("\n }");
cnt++;
}