Skip to content

Commit f07ede8

Browse files
committed
Fix resource leak
As reported by Coverity Scan
1 parent abe00b8 commit f07ede8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/mat73.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,10 @@ Mat_H5ReadVarInfo(matvar_t *matvar, hid_t dset_id)
465465

466466
matvar->internal->id = dset_id;
467467
attr_id = H5Aopen_by_name(dset_id, ".", "MATLAB_class", H5P_DEFAULT, H5P_DEFAULT);
468-
if ( attr_id < 1 )
468+
if ( attr_id < 1 ) {
469+
H5Aclose(attr_id);
469470
return MATIO_E_FAIL_TO_IDENTIFY;
471+
}
470472
type_id = H5Aget_type(attr_id);
471473
class_str = (char *)calloc(H5Tget_size(type_id) + 1, 1);
472474
if ( NULL != class_str ) {

0 commit comments

Comments
 (0)