Print this page
smatch: check libld_* allocation functions

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/smatch/src/check_freeing_null.c
          +++ new/usr/src/tools/smatch/src/check_freeing_null.c
↓ open down ↓ 32 lines elided ↑ open up ↑
  33   33          name = expr_to_var(arg_expr);
  34   34          sm_warning("calling %s() when '%s' is always NULL.", fn, name);
  35   35          free_string(name);
  36   36  }
  37   37  
  38   38  void check_freeing_null(int id)
  39   39  {
  40   40          my_id = id;
  41   41          if (!option_spammy)
  42   42                  return;
  43      -        if (option_project == PROJ_KERNEL)
       43 +        if (option_project == PROJ_KERNEL) {
  44   44                  add_function_hook("kfree", &match_free, NULL);
  45      -        else
       45 +        } else {
  46   46                  add_function_hook("free", &match_free, NULL);
       47 +        }
       48 +
       49 +        if (option_project == PROJ_ILLUMOS_USER)
       50 +                add_function_hook("libld_free", &match_free, NULL);
  47   51  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX