mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-21 03:13:42 +08:00
Fixed a different set of potential memory leaks paired with the previous ones.
This commit is contained in:
parent
436b53da9b
commit
2ab47745cc
@ -423,7 +423,7 @@ nc4_get_hdf_typeid(NC_HDF5_FILE_INFO_T *h5, nc_type xtype,
|
||||
}
|
||||
assert(*hdf_typeid != -1);
|
||||
|
||||
exit:
|
||||
exit:
|
||||
if (typeid > 0 && H5Tclose(typeid) < 0)
|
||||
BAIL2(NC_EHDFERR);
|
||||
return retval;
|
||||
@ -1386,11 +1386,11 @@ var_create_dataset(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var, int write_dimid)
|
||||
BAIL(NC_EHDFERR);
|
||||
|
||||
/* Szip? NO! We don't want anyone to produce szipped netCDF files! */
|
||||
/* #ifdef USE_SZIP */
|
||||
/* if (var->options_mask) */
|
||||
/* if (H5Pset_szip(plistid, var->options_mask, var->bits_per_pixel) < 0) */
|
||||
/* BAIL(NC_EHDFERR); */
|
||||
/* #endif */
|
||||
/* #ifdef USE_SZIP */
|
||||
/* if (var->options_mask) */
|
||||
/* if (H5Pset_szip(plistid, var->options_mask, var->bits_per_pixel) < 0) */
|
||||
/* BAIL(NC_EHDFERR); */
|
||||
/* #endif */
|
||||
|
||||
/* If the user wants to fletcher error correcton, set that up now. */
|
||||
if (var->fletcher32)
|
||||
@ -1545,7 +1545,7 @@ var_create_dataset(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var, int write_dimid)
|
||||
BAIL(retval);
|
||||
}
|
||||
|
||||
exit:
|
||||
exit:
|
||||
if (typeid > 0 && H5Tclose(typeid) < 0)
|
||||
BAIL2(NC_EHDFERR);
|
||||
if (plistid > 0 && H5Pclose(plistid) < 0)
|
||||
@ -1733,7 +1733,7 @@ put_att_grpa(NC_GRP_INFO_T *grp, int varid, NC_ATT_INFO_T *att)
|
||||
if (H5Awrite(attid, file_typeid, data) < 0)
|
||||
BAIL(NC_EATTMETA);
|
||||
|
||||
exit:
|
||||
exit:
|
||||
if (file_typeid && H5Tclose(file_typeid))
|
||||
BAIL2(NC_EHDFERR);
|
||||
if (attid > 0 && H5Aclose(attid) < 0)
|
||||
@ -3394,7 +3394,7 @@ nc4_convert_type(const void *src, void *dest,
|
||||
case NC_FLOAT:
|
||||
for (fp = (float *)src, fp1 = dest; count < len; count++)
|
||||
{
|
||||
/* if (*fp > X_FLOAT_MAX || *fp < X_FLOAT_MIN)
|
||||
/* if (*fp > X_FLOAT_MAX || *fp < X_FLOAT_MIN)
|
||||
(*range_error)++;*/
|
||||
*fp1++ = *fp++;
|
||||
}
|
||||
@ -3601,10 +3601,12 @@ nc4_rec_match_dimscales(NC_GRP_INFO_T *grp)
|
||||
if ((dataset_ndims = H5Sget_simple_extent_dims(spaceid, h5dimlen,
|
||||
h5dimlenmax)) < 0) {
|
||||
free(h5dimlenmax);
|
||||
free(h5dimlen);
|
||||
return NC_EHDFERR;
|
||||
}
|
||||
if (dataset_ndims != var->ndims) {
|
||||
free(h5dimlenmax);
|
||||
free(h5dimlen);
|
||||
return NC_EHDFERR;
|
||||
}
|
||||
}
|
||||
@ -3617,6 +3619,7 @@ nc4_rec_match_dimscales(NC_GRP_INFO_T *grp)
|
||||
|
||||
/* Release the space object. */
|
||||
if (H5Sclose(spaceid) < 0) {
|
||||
free(h5dimlen);
|
||||
free(h5dimlenmax);
|
||||
return NC_EHDFERR;
|
||||
}
|
||||
@ -3643,14 +3646,18 @@ nc4_rec_match_dimscales(NC_GRP_INFO_T *grp)
|
||||
|
||||
LOG((3, "%s: creating phony dim for var %s", __func__, var->name));
|
||||
if ((retval = nc4_dim_list_add(&grp->dim, &dim))) {
|
||||
free(h5dimlenmax)
|
||||
free(h5dimlenmax);
|
||||
free(h5dimlen);
|
||||
return retval;
|
||||
}
|
||||
grp->ndims++;
|
||||
dim->dimid = grp->nc4_info->next_dimid++;
|
||||
sprintf(phony_dim_name, "phony_dim_%d", dim->dimid);
|
||||
if (!(dim->name = strdup(phony_dim_name)))
|
||||
if (!(dim->name = strdup(phony_dim_name))) {
|
||||
free(h5dimlenmax);
|
||||
free(h5dimlen);
|
||||
return NC_ENOMEM;
|
||||
}
|
||||
dim->len = h5dimlen[d];
|
||||
if (h5dimlenmax[d] == H5S_UNLIMITED)
|
||||
dim->unlimited = NC_TRUE;
|
||||
@ -3786,6 +3793,6 @@ nc4_get_typeclass(const NC_HDF5_FILE_INFO_T *h5, nc_type xtype, int *type_class)
|
||||
*type_class = type->nc_type_class;
|
||||
}
|
||||
|
||||
exit:
|
||||
exit:
|
||||
return retval;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user