free hdf5-specific var info and cleanup
@@ -1182,7 +1182,6 @@ var_free(NC_VAR_INFO_T *var)
return retval;
ncindexfree(var->att);
- /* Free some things that may be allocated. */
/* Free some things that may be allocated. */
if (var->chunksizes)
free(var->chunksizes);
@@ -1233,6 +1232,10 @@ var_free(NC_VAR_INFO_T *var)
if (var->params)
free(var->params);
+ /* Delete any format-specific info. */
+ if (var->format_var_info)
+ free(var->format_var_info);
+
/* Delete the var. */
free(var);
@@ -1242,7 +1245,7 @@ var_free(NC_VAR_INFO_T *var)
/**
* @internal Delete a var, and free the memory.
*
- * @param grp the containing group
+ * @param grp Pointer to the strct for the containing group.
* @param var Pointer to the var info struct of var to delete.
*
* @return ::NC_NOERR No error.
@@ -1253,15 +1256,13 @@ nc4_var_list_del(NC_GRP_INFO_T* grp, NC_VAR_INFO_T *var)
{
int i;
- if(var == NULL)
- return NC_NOERR;
+ assert(var && grp);
/* Remove from lists */
- if(grp) {
i = ncindexfind(grp->vars, (NC_OBJ *)var);
if (i >= 0)
ncindexidel(grp->vars, i);
- }
+
return var_free(var);
}
