From 4cdcfe6dd3b19703ef3cad9ed448a7b45af00a22 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Tue, 30 Jan 2024 16:09:25 -0800 Subject: [PATCH] Qt: Fix potential null deref --- src/platform/qt/utils.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/platform/qt/utils.cpp b/src/platform/qt/utils.cpp index 99859dbc4..c445c41b8 100644 --- a/src/platform/qt/utils.cpp +++ b/src/platform/qt/utils.cpp @@ -138,7 +138,14 @@ bool extractMatchingFile(VDir* dir, std::function filter) continue; } VFile* outfile = VFileOpen(target.toUtf8().constData(), O_WRONLY | O_TRUNC | O_CREAT); + if (!outfile) { + return false; + } VFile* infile = dir->openFile(dir, entry->name(entry), O_RDONLY); + if (!infile) { + outfile->close(outfile); + return false; + } VFileDevice::copyFile(infile, outfile); infile->close(infile); outfile->close(outfile);