Commit e16e64f9 authored by Björn Töpel's avatar Björn Töpel Committed by Andrii Nakryiko
Browse files

selftests/bpf: Sanitize pointer prior fclose()



There are scenarios where env.{sub,}test_state->stdout_saved, can be
NULL, e.g. sometimes when the watchdog timeout kicks in, or if the
open_memstream syscall is not available.

Avoid crashing test_progs by adding an explicit NULL check prior the
fclose() call.

Signed-off-by: default avatarBjörn Töpel <bjorn@rivosinc.com>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/bpf/20250318081648.122523-1-bjorn@kernel.org
parent 79db658a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment