mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-17 16:47:50 +00:00
test/crit-recode: fix file handle leak in image read
Use 'with' statement instead of open().read() to ensure the file handle is properly closed. Assisted-by: Claude Code (claude-opus-4-6) Signed-off-by: Adrian Reber <areber@redhat.com>
This commit is contained in:
parent
4a50cc1744
commit
c40d1b8b10
1 changed files with 2 additions and 1 deletions
|
|
@ -61,7 +61,8 @@ for imgf in find.stdout.readlines():
|
|||
if imgf_b.startswith(b'rule-'):
|
||||
continue
|
||||
|
||||
o_img = open(imgf.decode(), "rb").read()
|
||||
with open(imgf.decode(), "rb") as fh:
|
||||
o_img = fh.read()
|
||||
if not recode_and_check(imgf, o_img, False):
|
||||
test_pass = False
|
||||
if not recode_and_check(imgf, o_img, True):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue