Print this page
10476 file(1) could be smatch clean

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/file/magicutils.c
          +++ new/usr/src/cmd/file/magicutils.c
↓ open down ↓ 21 lines elided ↑ open up ↑
  22   22   * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
  25   25  
  26   26  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  27   27  /*        All Rights Reserved   */
  28   28  
  29   29  /*      Copyright (c) 1987, 1988 Microsoft Corporation  */
  30   30  /*        All Rights Reserved   */
  31   31  
  32      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  33      -
  34   32  #include <stdio.h>
  35   33  #include <stdlib.h>
  36   34  #include <string.h>
  37   35  #include <ctype.h>
  38   36  #include <errno.h>
  39   37  #include <limits.h>
  40   38  #include <inttypes.h>
  41   39  #include <sys/types.h>
  42   40  #include <libintl.h>
  43   41  
↓ open down ↓ 192 lines elided ↑ open up ↑
 236  234                  mend = mend1;
 237  235                  ep = ep1;
 238  236          } else {
 239  237                  mtab = mtab2;
 240  238                  mend = mend2;
 241  239                  ep = ep2;
 242  240          }
 243  241  
 244  242          /* mtab may have been allocated on a previous f_mkmtab call */
 245  243          if (mtab == (Entry *)NULL) {
 246      -                if ((mtab = calloc(sizeof (Entry), NENT)) == NULL) {
      244 +                if ((mtab = calloc(NENT, sizeof (Entry))) == NULL) {
 247  245                          int err = errno;
 248  246                          (void) fprintf(stderr, gettext("%s: malloc "
 249  247                              "failed: %s\n"), File, strerror(err));
 250  248                          return (-1);
 251  249                  }
 252  250  
 253  251                  ep = mtab;
 254  252                  mend = &mtab[NENT];
 255  253          }
 256  254  
↓ open down ↓ 886 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX