Skip to content

Commit 3730be9

Browse files
Merge pull request #385 from chrisemblhh/fix_uninitialised
Fix 'uninitialised variable' problem in napi5.c
2 parents f6513d3 + 84b4b92 commit 3730be9

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/napi5.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2521,10 +2521,12 @@ NXstatus NX5getattra(NXhandle handle, char* name, void* data)
25212521
tclass = H5Tget_class(datatype);
25222522
/* stop gap kludge for fixed length strings */
25232523
if (tclass == H5T_C_S1) {
2524-
int datalen; /* fishy - uninitialised */
2525-
status = readStringAttributeN(pFile->iCurrentA, data, datalen);
2524+
char *datatmp = NULL;
2525+
status = readStringAttribute(pFile->iCurrentA, &datatmp);
25262526
if (status < 0)
25272527
return NX_ERROR;
2528+
strcpy(data, datatmp);
2529+
free(datatmp);
25282530
return NX_OK;
25292531
}
25302532

0 commit comments

Comments
 (0)