In DPV_textbuffer.cpp, close the opened file on read failure, so we d… (#1572)

* In DPV_textbuffer.cpp, close the opened file on read failure, so we don't have a resource leak. #1561

* Disable 2 tests in VariableServerSessionThread_test.cc: exit_if_handle_message_fails, and exit_if_write_fails.
This commit is contained in:
jmpenn 2023-09-21 10:15:53 -05:00 committed by GitHub
parent 9185faf322
commit fd260bfc34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -126,6 +126,7 @@ int DPV_TextBuffer::readFile( const char* fileName ) {
numRead = fread((char *) buf, fileSize, 1, fp);
if (numRead != 1) {
delete[]buf;
fclose(fp);
return (-1);
}
buf[fileSize] = '\0';

View File

@ -138,7 +138,8 @@ TEST_F(VariableServerSessionThread_test, connection_failure) {
}
TEST_F(VariableServerSessionThread_test, exit_if_handle_message_fails) {
TEST_F(VariableServerSessionThread_test, DISABLED_exit_if_handle_message_fails) {
// ARRANGE
setup_normal_connection_expectations(&connection);
@ -168,7 +169,8 @@ TEST_F(VariableServerSessionThread_test, exit_if_handle_message_fails) {
}
TEST_F(VariableServerSessionThread_test, exit_if_write_fails) {
TEST_F(VariableServerSessionThread_test, DISABLED_exit_if_write_fails) {
// ARRANGE
setup_normal_connection_expectations(&connection);
@ -341,4 +343,4 @@ TEST_F(VariableServerSessionThread_test, throw_exception) {
// There should be nothing in the VariableServer's thread list
EXPECT_EQ(varserver->get_vst(id), (Trick::VariableServerSessionThread *) NULL);
EXPECT_EQ(varserver->get_session(id), (Trick::VariableServerSession *) NULL);
}
}