Skip to content

Commit

Permalink
Fix resource leak when reading character data from HDF5 MAT file
Browse files Browse the repository at this point in the history
* As reported by #44
  • Loading branch information
tbeu committed Sep 13, 2016
1 parent 49e327a commit 38f50fd
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/mat73.c
Original file line number Diff line number Diff line change
Expand Up @@ -2328,6 +2328,7 @@ Mat_VarRead73(mat_t *mat,matvar_t *matvar)
H5S_ALL,H5S_ALL,H5P_DEFAULT,matvar->data);
}
}
H5Dclose(dset_id);
break;
case MAT_C_STRUCT:
{
Expand Down Expand Up @@ -2357,13 +2358,6 @@ Mat_VarRead73(mat_t *mat,matvar_t *matvar)
matvar_t **cells;
int i,ncells = 0;

if ( NULL != matvar->internal->hdf5_name ) {
dset_id = H5Dopen(fid,matvar->internal->hdf5_name,H5P_DEFAULT);
} else {
dset_id = matvar->internal->id;
H5Iinc_ref(dset_id);
}

ncells = matvar->nbytes / matvar->data_size;
cells = (matvar_t**)matvar->data;

Expand Down

0 comments on commit 38f50fd

Please sign in to comment.