Print this page
10124 smatch fixes for cryptoadm

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/cmd-crypto/cryptoadm/adm_uef.c
          +++ new/usr/src/cmd/cmd-crypto/cryptoadm/adm_uef.c
↓ open down ↓ 15 lines elided ↑ open up ↑
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   */
  24   24  /*
  25   25   * Copyright 2010 Nexenta Systems, Inc.  All rights resrved.
       26 + * Copyright (c) 2018, Joyent, Inc.
  26   27   */
  27   28  
  28   29  #include <cryptoutil.h>
  29   30  #include <fcntl.h>
  30   31  #include <libintl.h>
  31   32  #include <stdio.h>
  32   33  #include <stdlib.h>
  33   34  #include <strings.h>
  34   35  #include <unistd.h>
  35   36  #include <errno.h>
↓ open down ↓ 118 lines elided ↑ open up ↑
 154  155  {
 155  156          int i, n = 0;
 156  157          mechlist_t *p = mlist;
 157  158  
 158  159          while (p != NULL) {
 159  160                  p = p->next;
 160  161                  n++;
 161  162          }
 162  163  
 163  164          *pmech_list = malloc(n * sizeof (CK_MECHANISM_TYPE));
 164      -        if (pmech_list == NULL) {
      165 +        if (*pmech_list == NULL) {
 165  166                  cryptodebug("out of memory");
 166  167                  return (FAILURE);
 167  168          }
 168  169          p = mlist;
 169  170          for (i = 0; i < n; i++) {
 170  171                  if (pkcs11_str2mech(p->name, &(*pmech_list[i])) != CKR_OK) {
 171  172                          free(*pmech_list);
 172  173                          return (FAILURE);
 173  174                  }
 174  175                  p = p->next;
↓ open down ↓ 1492 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX