Print this page
6659 nvlist_free(NULL) is a no-op


  63 
  64         /*
  65          * Service type is unique, only one entry
  66          * of each service type is allowed
  67          */
  68         if (nvlist_alloc(&nvl, NV_UNIQUE_NAME, 0))
  69                 return (NULL);
  70 
  71         return (nvl);
  72 }
  73 
  74 /*
  75  * reparse_free()
  76  *
  77  * Function to free memory of a nvlist allocated previously
  78  * by reparse_init().
  79  */
  80 void
  81 reparse_free(nvlist_t *nvl)
  82 {
  83         if (nvl)
  84                 nvlist_free(nvl);
  85 }
  86 
  87 /*
  88  * reparse_parse()
  89  *
  90  * Parse the specified string and populate the nvlist with the svc_types
  91  * and data from the 'string'.  The string could be read from the reparse
  92  * point symlink body. This routine will allocate memory that must be
  93  * freed by reparse_free().
  94  *
  95  * If ok return 0 and the nvlist is populated, otherwise return error code.
  96  */
  97 int
  98 reparse_parse(const char *string, nvlist_t *nvl)
  99 {
 100         int err;
 101 
 102         if (string == NULL || nvl == NULL)
 103                 return (EINVAL);




  63 
  64         /*
  65          * Service type is unique, only one entry
  66          * of each service type is allowed
  67          */
  68         if (nvlist_alloc(&nvl, NV_UNIQUE_NAME, 0))
  69                 return (NULL);
  70 
  71         return (nvl);
  72 }
  73 
  74 /*
  75  * reparse_free()
  76  *
  77  * Function to free memory of a nvlist allocated previously
  78  * by reparse_init().
  79  */
  80 void
  81 reparse_free(nvlist_t *nvl)
  82 {

  83         nvlist_free(nvl);
  84 }
  85 
  86 /*
  87  * reparse_parse()
  88  *
  89  * Parse the specified string and populate the nvlist with the svc_types
  90  * and data from the 'string'.  The string could be read from the reparse
  91  * point symlink body. This routine will allocate memory that must be
  92  * freed by reparse_free().
  93  *
  94  * If ok return 0 and the nvlist is populated, otherwise return error code.
  95  */
  96 int
  97 reparse_parse(const char *string, nvlist_t *nvl)
  98 {
  99         int err;
 100 
 101         if (string == NULL || nvl == NULL)
 102                 return (EINVAL);