rem: fclose(fd);
context: unsigned int getdiskstat(struct disk_stat **disks, struct partition_stat **partitions){  FILE* fd;  int units,      i,      disk_type,      disk_num,      cDisk=0,      cPartition=0;  *disks = NULL;  *partitions = NULL;  buff[BUFFSIZE-1] = 0;   units = getFileLines("/proc/diskstats");  fd = fopen("/proc/diskstats", "rb");  if(!fd) crash("/proc/diskstats");  for (i=0; i<units; i++){    if (!fgets(buff,BUFFSIZE-1,fd)){      fclose(fd);      crash("/proc/diskstats");    }    sscanf(buff, "    %d    %d", &disk_type, &disk_num);    if (disk_num == 0){      (*disks) = realloc(*disks, (cDisk+1)*sizeof(struct disk_stat));      sscanf(buff,  "   %d    %*d %15s %u %u %llu %u %u %u %llu %u %u %u %u",        &(*disks)[cDisk].disk_type,        //&unused,        (*disks)[cDisk].disk_name,        &(*disks)[cDisk].reads,        &(*disks)[cDisk].merged_reads,        &(*disks)[cDisk].reads_sectors,        &(*disks)[cDisk].milli_reading,        &(*disks)[cDisk].writes,        &(*disks)[cDisk].merged_writes,        &(*disks)[cDisk].written_sectors,        &(*disks)[cDisk].milli_writing,        &(*disks)[cDisk].inprogress_IO,        &(*disks)[cDisk].milli_spent_IO,        &(*disks)[cDisk].weighted_milli_spent_IO      );        (*disks)[cDisk].partitions=0;      cDisk++;    }else{      (*partitions) = realloc(*partitions, (cPartition+1)*sizeof(struct partition_stat));      fflush(stdout);      sscanf(buff,  "   %d    %d %15s %u %llu %u %u",        &(*partitions)[cPartition].disk_type,        &(*partitions)[cPartition].partition_num,        (*partitions)[cPartition].partition_name,        &(*partitions)[cPartition].reads,        &(*partitions)[cPartition].reads_sectors,        &(*partitions)[cPartition].writes,        &(*partitions)[cPartition].requested_writes      );      (*partitions)[cPartition++].parent_disk = &((*disks)[cDisk-1]);      (*disks)[cDisk-1].partitions++;	    }  }  fclose(fd);  return cDisk;}