From fb9622d05a520f06d8b4424cdb6b092840636906 Mon Sep 17 00:00:00 2001 From: Simon McVittie <smcv@collabora.com> Date: Thu, 9 Jan 2020 12:55:25 +0000 Subject: [PATCH] graphics: Don't end a NULL ELF object or close an invalid fd Signed-off-by: Simon McVittie <smcv@collabora.com> --- steam-runtime-tools/graphics.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/steam-runtime-tools/graphics.c b/steam-runtime-tools/graphics.c index 20ff7481c..ffd1ed3bc 100644 --- a/steam-runtime-tools/graphics.c +++ b/steam-runtime-tools/graphics.c @@ -2388,8 +2388,12 @@ _srt_get_library_class (const gchar *library) class = gelf_getclass (elf); out: - elf_end (elf); - close (fd); + if (elf != NULL) + elf_end (elf); + + if (fd >= 0) + close (fd); + return class; } -- GitLab