ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/ihost/libstatgrab/disk_stat.c
(Generate patch)

Comparing projects/cms/source/ihost/libstatgrab/disk_stat.c (file contents):
Revision 1.4 by pajs, Mon May 13 12:47:15 2002 UTC vs.
Revision 1.5 by pajs, Mon May 13 13:21:36 2002 UTC

# Line 37 | Line 37 | char *get_disk_stats(){
37          system_disks_t *sd_ptr=sd;
38          int counter=0;
39          char *xml_disk_stats;
40 +        char *xml_disk_stats_ptr;
41   #ifdef SOLARIS
42          struct mnttab mp;
43          struct statvfs df;
# Line 169 | Line 170 | char *get_disk_stats(){
170          xml_disk_stats=strdup("<disk>");
171          
172          while(sd_ptr!=NULL){
173 +                xml_disk_stats_ptr=xml_disk_stats;
174                  if((xml_disk_stats=strf("%s<p%d name=\"%s\" mount=\"%s\" kbytes=\"%ld\" used=\"%ld\" avail=\"%ld\" totalinodes=\"%ld\" freeinodes=\"%ld\"></p%d>", xml_disk_stats, counter, sd_ptr->disk->device_name, sd_ptr->disk->mnt_point, sd_ptr->disk->size, sd_ptr->disk->used, sd_ptr->disk->avail, sd_ptr->disk->t_inodes, sd_ptr->disk->f_inodes, counter)) == NULL){
175                          errf("strf failed (%m)");
176                          return NULL;
177                  }
178 +                free(xml_disk_stats_ptr);
179                  sd_ptr=sd_ptr->next_disk;
180                  counter++;
181          }
182  
183          xml_disk_stats=strf("%s</disk>",xml_disk_stats);
184 +
185 +        /* Cleaning up */
186 +        sd_ptr=sd;
187 +        while(sd_ptr!=NULL){
188 +                sd=sd_ptr->next_disk;
189 +                free(sd_ptr->disk->device_name);
190 +                free(sd_ptr->disk->mnt_point);
191 +                free(sd_ptr->disk);
192 +                free(sd_ptr);
193 +                sd_ptr=sd;
194 +        }
195  
196          return xml_disk_stats;
197   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines