Skip to content

Commit c29f3ed

Browse files
committed
Fix use-after-close in writeSolution when ranging fails
Add missing return statement after returnFromWriteSolution() call when getRangingInterface() returns an error, preventing fprintf() from writing to an already-closed file handle.
1 parent b05711e commit c29f3ed

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

highs/lp_data/Highs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3518,7 +3518,7 @@ HighsStatus Highs::writeSolution(const std::string& filename,
35183518
interpretCallStatus(options_.log_options, this->getRangingInterface(),
35193519
return_status, "getRangingInterface");
35203520
if (return_status == HighsStatus::kError)
3521-
returnFromWriteSolution(file, return_status);
3521+
return returnFromWriteSolution(file, return_status);
35223522
fprintf(file, "\n# Ranging\n");
35233523
writeRangingFile(file, model_.lp_, info_.objective_function_value, basis_,
35243524
solution_, ranging_, style);

0 commit comments

Comments
 (0)