* stop trace so we can reap currently produced data
*/
for_each_dip(dip, i) {
+ if (dip->fd == -1)
+ continue;
if (ioctl(dip->fd, BLKTRACESTOP) < 0)
perror("BLKTRACESTOP");
}
device_information = realloc(device_information, (ndevs + 1) * sizeof(*dip));
dip = &device_information[ndevs];
+ memset(dip, 0, sizeof(*dip));
+ dip->fd = -1;
strcpy(dip->buts_name, buts_name);
- strcpy(dip->path, buts_name);
+ dip->path = strdup(buts_name);
ndevs++;
dip->threads = malloc(ncpus * sizeof(struct thread_information));
memset(dip->threads, 0, ncpus * sizeof(struct thread_information));
fclose(tip->ofile);
free(dip->threads);
+ free(dip->path);
}
free(device_information);