[BACK]Return to rusers.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / rusers

Diff for /src/usr.bin/rusers/rusers.c between version 1.28 and 1.29

version 1.28, 2007/05/25 21:27:16 version 1.29, 2007/09/02 15:19:34
Line 260 
Line 260 
   
         if (up->uia_cnt == 0)          if (up->uia_cnt == 0)
                 ut = NULL;                  ut = NULL;
         else if ((ut = malloc(up->uia_cnt * sizeof(*ut))) == NULL)          else if ((ut = calloc(up->uia_cnt, sizeof(*ut))) == NULL)
                 err(1, NULL);                  err(1, NULL);
         entry->users = ut;          entry->users = ut;
         entry->count = up->uia_cnt;          entry->count = up->uia_cnt;
Line 315 
Line 315 
   
         if (up3->utmp_array_len == 0)          if (up3->utmp_array_len == 0)
                 ut = NULL;                  ut = NULL;
         else if ((ut = malloc(up3->utmp_array_len * sizeof(*ut))) == NULL)          else if ((ut = calloc(up3->utmp_array_len, sizeof(*ut))) == NULL)
                 err(1, NULL);                  err(1, NULL);
         entry->users = ut;          entry->users = ut;
         entry->count = up3->utmp_array_len;          entry->count = up3->utmp_array_len;
Line 689 
Line 689 
         for (i = 0, count = 0; i < nentries; i++)          for (i = 0, count = 0; i < nentries; i++)
                 count += hostinfo[i].count;                  count += hostinfo[i].count;
   
         new_hostinfo = (struct host_info *)malloc(sizeof(*entry) * count);          new_hostinfo = (struct host_info *)calloc(sizeof(*entry), count);
         if (new_hostinfo == NULL)          if (new_hostinfo == NULL)
                 err(1, NULL);                  err(1, NULL);
         for (i = 0, entry = new_hostinfo; i < nentries; i++) {          for (i = 0, entry = new_hostinfo; i < nentries; i++) {

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.29