Skip to content

Commit a99db9b

Browse files
Fix FileStream leak in ClassPath.IsJmodFile (#1424)
Add using to File.OpenRead in IsJmodFile so the stream is disposed on all return paths, matching the pattern used by the companion IsJarFile method. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 05e9e8f commit a99db9b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/Xamarin.Android.Tools.Bytecode/ClassPath.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public static bool IsJmodFile (string jmodFile)
145145
if (jmodFile == null)
146146
throw new ArgumentNullException (nameof (jmodFile));
147147
try {
148-
var f = File.OpenRead (jmodFile);
148+
using var f = File.OpenRead (jmodFile);
149149
var h = new byte[4];
150150
if (f.Read (h, 0, h.Length) != 4) {
151151
return false;

0 commit comments

Comments
 (0)