On Thu, 14 Oct 2021 18:02:04 +0300 "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@xxxxxxxxx> wrote: > + read_file_number(fd, &cpus_data[j].count, 4); > + size -= 4; > + do_print(OPTIONS, "%lld [samples count for CPU %d]\n", cpus_data[j].count, j); > + cpus_data[j].times = calloc(cpus_data[j].count, sizeof(long long)); > + cpus_data[j].offsets = calloc(cpus_data[j].count, sizeof(long long)); > + cpus_data[j].scalings = calloc(cpus_data[j].count, sizeof(long long)); > + cpus_data[j].frac = calloc(cpus_data[j].count, sizeof(long long)); > + if (!cpus_data[j].times || !cpus_data[j].offsets || > + !cpus_data[j].scalings || !cpus_data[j].frac) > + goto out; > + for (i = 0; i < cpus_data[j].count; i++) { > + if (size < 8) > + goto out; > + read_file_number(fd, cpus_data[j].times + i, 8); > + size -= 8; > + } > + for (i = 0; i < cpus_data[j].count; i++) { > + if (size < 8) > + goto out; > + read_file_number(fd, cpus_data[j].offsets + i, 8); > + size -= 8; > + } > + for (i = 0; i < cpus_data[j].count; i++) { > + if (size < 8) > + goto out; > + read_file_number(fd, cpus_data[j].scalings + i, 8); > + size -= 8; > + } > + } > > + if (size > 0) { > + for (j = 0; j < cpus; j++) { > + if (!cpus_data[j].frac) > + goto out; > + for (i = 0; i < cpus_data[j].count; i++) { > + if (size < 8) > + goto out; > + read_file_number(fd, cpus_data[j].frac + i, 8); > + size -= 8; > + } > + } > } > + > + for (j = 0; j < cpus; j++) { > + for (i = 0; i < cpus_data[j].count; i++) > + do_print(OPTIONS, "\t%lld %lld %llu %llu[offset * scaling >> fraction @ time]\n", > + cpus_data[j].offsets[i], cpus_data[j].scalings[i], > + cpus_data[j].frac[i], cpus_data[j].times[i]); > + > + } > + > out: > - free(times); > - free(offsets); > - free(scalings); > + if (j < cpus) > + do_print(OPTIONS, "Broken time shift option\n"); > + for (j = 0; j < cpus; j++) { > + free(cpus_data[j].times); > + free(cpus_data[j].offsets); > + free(cpus_data[j].scalings); Looks like you forgot to add: free(cpus_data[j].frac); This is the only issue I found in this series. I'll just add a patch to fix it and move on. Thanks! -- Steve > + } > + free(cpus_data);
![]() |