From 12c6ccc97b735d0a2f386fbb79ef7d8803c25a36 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sun, 23 Feb 2025 11:41:11 +0000 Subject: [PATCH] ResReadSim.c remove existing fclose() as conflict with recent change After futher review of this function it looks like the existing fclose() is not in the correct place, and recent patches have added fclose() to this function in better places (covering all returns) but did not take into account the existing misplaced fclose(). --- resis/ResReadSim.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/resis/ResReadSim.c b/resis/ResReadSim.c index 0320c3a9..2f61dc88 100644 --- a/resis/ResReadSim.c +++ b/resis/ResReadSim.c @@ -191,8 +191,11 @@ ResReadSim(simfile, fetproc, capproc, resproc, attrproc, mergeproc, subproc) case 'r': break; default: + /* we expect fclose(fp) and early return to occur below, + * but code path might still modify result (maybe to zero) + * allowing us to loop again, which will then access 'fp' + */ result = 1; - fclose(fp); break; } if (fettype == -1)