Skip to content

Commit

Permalink
Merge pull request #412 from LLNL/rc2main-mcm86-30aug24-hdfdrvr-leaks
Browse files Browse the repository at this point in the history
RC2Main merge pull request #407
  • Loading branch information
markcmiller86 authored Sep 3, 2024
2 parents e6ac504 + 9607f3e commit 9af504e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/hdf5_drv/silo_hdf5.c
Original file line number Diff line number Diff line change
Expand Up @@ -3851,7 +3851,9 @@ db_hdf5_get_comp_var(DBfile *_dbfile, char const *name, hsize_t *nelmts,
/* create a component type with just one member,
the one we're interested in */
memtype = H5Tcreate(H5T_COMPOUND, H5Tget_size(comptype));
H5Tinsert(memtype, H5Tget_member_name(stypeid, membno), 0, comptype);
memname = H5Tget_member_name(stypeid, membno);
H5Tinsert(memtype, memname, 0, comptype);
free(memname);

/* read attribute for the silo object data */
H5Aread(attr, memtype, comptype==T_str256?tmp:*buf);
Expand Down Expand Up @@ -8356,6 +8358,13 @@ db_hdf5_ReadVarVals(DBfile *_dbfile, char const *vname, int mode,
p += H5Tget_size(mtype);
}

if (dsnames)
{
for (i = 0; i < dscount; i++)
FREE(dsnames[i]);
FREE(dsnames);
}

/* Close everything */
H5Tclose(ftype);
H5Sclose(fspace);
Expand Down
1 change: 1 addition & 0 deletions src/silo/silo_f.c
Original file line number Diff line number Diff line change
Expand Up @@ -3871,6 +3871,7 @@ DBGETCURVE_FC (int *dbid, FCD_DB _name, int *lname, int *maxpts, void *xvals,
memcpy (xvals, cu->x, total_size) ;
memcpy (yvals, cu->y, total_size) ;
DBFreeCurve (cu) ;
if (name) free(name);
} API_END ;
return 0 ;
}
Expand Down
18 changes: 18 additions & 0 deletions tests/compression.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,13 @@ main(int argc, char *argv[])
if (DBWrite(dbfile, tmpname, fval, fdims, ndims, DB_FLOAT) < 0)
{
if (DBErrno() == E_COMPRESSION)
{
free(fval);
free(frval);
free(dval);
free(drval);
return GNU_AUTOTEST_SKIP_CODE; /* compression requested not supported in this build */
}
nerrors++;
break;
}
Expand All @@ -249,7 +255,13 @@ main(int argc, char *argv[])
if (DBWrite(dbfile, tmpname, dval, ddims, ndims, DB_DOUBLE) < 0)
{
if (DBErrno() == E_COMPRESSION)
{
free(fval);
free(frval);
free(dval);
free(drval);
return GNU_AUTOTEST_SKIP_CODE; /* compression requested not supported in this build */
}
nerrors++;
break;
}
Expand All @@ -273,7 +285,13 @@ main(int argc, char *argv[])
}

if (nerrors)
{
free(fval);
free(frval);
free(dval);
free(drval);
return nerrors;
}

/*
* Now try opening the file again and verify the simple
Expand Down

0 comments on commit 9af504e

Please sign in to comment.