Print this page
10111 dat_dictionary_create() use after free

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/udapl/libdat/common/dat_dictionary.c
          +++ new/usr/src/lib/udapl/libdat/common/dat_dictionary.c
↓ open down ↓ 20 lines elided ↑ open up ↑
  21   21   */
  22   22  /*
  23   23   * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.
  24   24   */
  25   25  
  26   26  /*
  27   27   * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  28   28   * Use is subject to license terms.
  29   29   */
  30   30  
  31      -#pragma ident   "%Z%%M% %I%     %E% SMI"
       31 +/*
       32 + * Copyright (c) 2018, Joyent, Inc.
       33 + */
  32   34  
  33   35  /*
  34   36   *
  35   37   * MODULE: dat_dictionary.c
  36   38   *
  37   39   * PURPOSE: dictionary data structure
  38   40   *
  39   41   * $Id: dat_dictionary.c,v 1.11 2003/08/05 19:01:48 jlentini Exp $
  40   42   */
  41   43  
↓ open down ↓ 95 lines elided ↑ open up ↑
 137  139              sizeof (DAT_DICTIONARY_NODE));
 138  140  
 139  141          p_dictionary->head->next = p_dictionary->tail;
 140  142          p_dictionary->tail->prev = p_dictionary->head;
 141  143  
 142  144          *pp_dictionary = p_dictionary;
 143  145  
 144  146  bail:
 145  147          if (DAT_SUCCESS != status) {
 146  148                  if (NULL != p_dictionary) {
 147      -                        dat_os_free(p_dictionary, sizeof (DAT_DICTIONARY));
 148      -
 149  149                          if (NULL != p_dictionary->head) {
 150  150                                  dat_os_free(p_dictionary->head,
 151  151                                      sizeof (DAT_DICTIONARY_NODE));
 152  152                          }
 153  153  
 154  154                          if (NULL != p_dictionary->tail) {
 155  155                                  dat_os_free(p_dictionary->tail,
 156  156                                      sizeof (DAT_DICTIONARY_NODE));
 157  157                          }
      158 +
      159 +                        dat_os_free(p_dictionary, sizeof (DAT_DICTIONARY));
 158  160                  }
      161 +
 159  162          }
 160  163  
 161  164          return (status);
 162  165  }
 163  166  
 164  167  
 165  168  /*
 166  169   * Function: dat_dictionary_destroy
 167  170   */
 168  171  
↓ open down ↓ 296 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX