Corrected a couple of potential memory related issues and an uninitialized variable issue.

This commit is contained in:
Ward Fisher 2018-06-08 11:38:11 -06:00
parent 595f39ce42
commit 335f25e947
2 changed files with 15 additions and 9 deletions

View File

@ -2192,13 +2192,19 @@ NC_open(const char *path0, int cmode, int basepe, size_t *chunksizehintp,
#ifdef USE_CDF5
cdf5built = 1;
#endif
if(!hdf5built && model == NC_FORMATX_NC4)
return NC_ENOTBUILT;
if(!hdf4built && model == NC_FORMATX_NC4 && version == 4)
return NC_ENOTBUILT;
if(!cdf5built && model == NC_FORMATX_NC3 && version == 5)
return NC_ENOTBUILT;
}
if(!hdf5built && model == NC_FORMATX_NC4) {
free(path);
return NC_ENOTBUILT;
}
if(!hdf4built && model == NC_FORMATX_NC4 && version == 4) {
free(path);
return NC_ENOTBUILT;
}
if(!cdf5built && model == NC_FORMATX_NC3 && version == 5) {
free(path);
return NC_ENOTBUILT;
}
}
/* Force flag consistentcy */
if(model == NC_FORMATX_NC4 || model == NC_FORMATX_NC_HDF4 || model == NC_FORMATX_DAP4)

View File

@ -198,7 +198,7 @@ genbin_defineglobalspecials(void)
static void
genbin_definespecialattributes(Symbol* var)
{
int stat;
int stat = NC_NOERR;
Specialdata* special = &var->var.special;
if(special->flags & _STORAGE_FLAG) {
int storage = special->_Storage;
@ -250,7 +250,7 @@ genbin_definespecialattributes(Symbol* var)
else
level = special->_FilterParams[0];
if(level > 9)
derror("Illegal deflate level");
derror("Illegal deflate level");
else {
stat = nc_def_var_deflate(var->container->ncid,
var->ncid,