This patch fixes the following Coverity complaint:
CID 183977 (#1 of 1): Resource leak (RESOURCE_LEAK)
17. leaked_storage: Variable str going out of scope leaks the storage it points to.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
if (bcs[i].fd < 0) {
log_err("fio: could not open file: %s\n", name);
ret = bcs[i].fd;
+ free(str);
goto err_file;
}
bcs[i].fifo = fifo_alloc(TRACE_FIFO_SIZE);
if (!is_blktrace(name, &bcs[i].swap)) {
log_err("fio: file is not a blktrace: %s\n", name);
+ free(str);
goto err_file;
}
ret = read_trace(td, &bcs[i]);
if (ret < 0) {
+ free(str);
goto err_file;
} else if (!ret) {
merge_finish_file(bcs, i, &nr_logs);