summaryrefslogtreecommitdiffstats
path: root/plugins/solidigm/solidigm-telemetry.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-06-30 22:38:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-06-30 22:38:48 +0000
commit01c4d3d32c5044d3d17055c2d94d40fee9d130e1 (patch)
tree2c213cd5436bff644fa7023b94674a9c12d2e1af /plugins/solidigm/solidigm-telemetry.c
parentAdding upstream version 2.4+really2.4. (diff)
downloadnvme-cli-01c4d3d32c5044d3d17055c2d94d40fee9d130e1.tar.xz
nvme-cli-01c4d3d32c5044d3d17055c2d94d40fee9d130e1.zip
Adding upstream version 2.5.upstream/2.5
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'plugins/solidigm/solidigm-telemetry.c')
-rw-r--r--plugins/solidigm/solidigm-telemetry.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/plugins/solidigm/solidigm-telemetry.c b/plugins/solidigm/solidigm-telemetry.c
index 9946991..472284a 100644
--- a/plugins/solidigm/solidigm-telemetry.c
+++ b/plugins/solidigm/solidigm-telemetry.c
@@ -112,7 +112,7 @@ int solidigm_get_telemetry_log(int argc, char **argv, struct command *cmd, struc
}
if (cfg.cfg_file) {
- char *conf_str = 0;
+ char *conf_str = NULL;
size_t length = 0;
err = read_file2buffer(cfg.cfg_file, &conf_str, &length);
@@ -121,9 +121,10 @@ int solidigm_get_telemetry_log(int argc, char **argv, struct command *cmd, struc
cfg.cfg_file, strerror(err));
goto close_fd;
}
- struct json_tokener * jstok = json_tokener_new();
+ struct json_tokener *jstok = json_tokener_new();
tl.configuration = json_tokener_parse_ex(jstok, conf_str, length);
+ free(conf_str);
if (jstok->err != json_tokener_success) {
SOLIDIGM_LOG_WARNING("Parsing error on JSON configuration file %s: %s (at offset %d)",
cfg.cfg_file,
@@ -160,11 +161,7 @@ int solidigm_get_telemetry_log(int argc, char **argv, struct command *cmd, struc
goto close_fd;
}
}
- solidigm_telemetry_log_header_parse(&tl);
- if (cfg.cfg_file)
- solidigm_telemetry_log_data_areas_parse(&tl, cfg.data_area);
- else
- solidigm_telemetry_log_cod_parse(&tl);
+ solidigm_telemetry_log_data_areas_parse(&tl, cfg.data_area);
json_print_object(tl.root, NULL);
json_free_object(tl.root);