Skip to content

Commit 8aa22da

Browse files
committed
hds-v5: Fix leakage of HDF5 datatype identifiers
1 parent 2cf1df4 commit 8aa22da

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

dat1NewPrim.c

+1
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ void dat1NewPrim( hid_t group_id, int ndim, const hsize_t h5dims[], hid_t h5type
175175
);
176176

177177
CLEANUP:
178+
if ( cparms > 0 ) H5Pclose( cparms );
178179
if (*status != SAI__OK) {
179180
/* tidy */
180181
if (*dataspace_id > 0) {

dat1Type.c

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ dat1Type( const HDSLoc *locator, int * status ) {
110110
);
111111

112112
thetype = dau1HdsType( h5type, status );
113+
if( h5type > 0 ) H5Tclose( h5type );
113114

114115
CLEANUP:
115116
return thetype;

datAlter.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,7 @@ datAlter( HDSLoc *locator, int ndim, const hdsdim dims[], int *status) {
385385

386386
CLEANUP:
387387
datAnnul(&parloc, status);
388-
if (*status != SAI__OK) {
389-
if (h5type > 0) H5Tclose( h5type );
390-
if (temploc) temploc = dat1FreeLoc( temploc, status );
391-
}
388+
if (h5type > 0) H5Tclose( h5type );
389+
if (temploc) temploc = dat1FreeLoc( temploc, status );
392390
return *status;
393391
}

datGet.c

+2
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ datGet(const HDSLoc *locator, const char *type_str, int ndim,
257257
tmpvalues = MEM_MALLOC( nelem * inlen );
258258
H5Tclose( h5type );
259259
h5type = tmptype;
260+
} else {
261+
if( tmptype > 0 ) H5Tclose( tmptype );
260262
}
261263
}
262264

0 commit comments

Comments
 (0)