Skip to content

Commit

Permalink
Remove trace-point that requires use-after-close reference
Browse files Browse the repository at this point in the history
It turns out that eclipse-omr#7325 was ineffective: compilers see straight
through that attempt to hide the use-after-close. The trace-point
doesn't provide any information that isn't already available by
other trace-points at the same level.

Signed-off-by: Keith W. Campbell <keithc@ca.ibm.com>
  • Loading branch information
keithc-ca committed May 13, 2024
1 parent b9a6ccc commit 9fc4a86
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 5 deletions.
3 changes: 0 additions & 3 deletions port/common/omrfilestream.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,9 @@ omrfilestream_close(struct OMRPortLibrary *portLibrary, OMRFileStream *fileStrea
Trc_PRT_filestream_close_invalidFileStream(fileStream);
rc = OMRPORT_ERROR_FILE_BADF;
} else {
/* copy handle to avoid "use-after-free(close)" warning */
void *fileTrace = fileStream;
rc = fclose(fileStream);
if (0 != rc) {
rc = portLibrary->error_set_last_error(portLibrary, errno, findError(errno));
Trc_PRT_filestream_close_failedToClose(fileTrace, rc);
}
}

Expand Down
2 changes: 1 addition & 1 deletion port/common/omrport.tdf
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ TraceException=Trc_PRT_filestream_open_invalidPath Group=omrfilestream Overhead=
TraceEntry=Trc_PRT_filestream_close_Entry Group=omrfilestream Overhead=1 Level=5 NoEnv Template="omrfilestream_close fileStream = %p"
TraceExit=Trc_PRT_filestream_close_Exit Group=j9filestrean Overhead=1 Level=5 NoEnv Template="omrfilestream_close returns code = %d"
TraceException=Trc_PRT_filestream_close_invalidFileStream Group=omrfilestream Overhead=1 Level=5 NoEnv Template="omrfilestream_close Invalid fileStream. fileStream = %p"
TraceException=Trc_PRT_filestream_close_failedToClose Group=omrfilestream Overhead=1 Level=5 NoEnv Template="omrfilestream_close Failed to close fileStream. fileStream = %p errorCode = %d"
TraceException=Trc_PRT_filestream_close_failedToClose Obsolete Group=omrfilestream Overhead=1 Level=5 NoEnv Template="omrfilestream_close Failed to close fileStream. fileStream = %p errorCode = %d"

TraceEntry=Trc_PRT_filestream_sync_Entry Group=omrfilestream Overhead=1 Level=5 NoEnv Template="omrfilestream_sync fileStream = %p"
TraceExit=Trc_PRT_filestream_sync_Exit Group=j9filestrean Overhead=1 Level=5 NoEnv Template="omrfilestream_sync returns code = %d"
Expand Down
1 change: 0 additions & 1 deletion port/win32/omrfilestream.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ omrfilestream_close(struct OMRPortLibrary *portLibrary, OMRFileStream *fileStrea
rc = fclose(fileStream);
if (0 != rc) {
rc = portLibrary->error_set_last_error(portLibrary, errno, findErrorFromErrno(errno));
Trc_PRT_filestream_close_failedToClose(fileStream, rc);
}
}

Expand Down

0 comments on commit 9fc4a86

Please sign in to comment.