From 090a16656de8a72718ce0258f99aa10f1d566759 Mon Sep 17 00:00:00 2001 From: Ricardo Barbedo Date: Tue, 7 Feb 2023 10:30:28 +0100 Subject: [PATCH] Only delete bitstream objects if non-null --- src/xilinx.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/xilinx.cpp b/src/xilinx.cpp index 8ac66dc..eb8aea4 100644 --- a/src/xilinx.cpp +++ b/src/xilinx.cpp @@ -387,8 +387,10 @@ void Xilinx::program(unsigned int offset, bool unprotect_flash) } } catch (std::exception &e) { printError("FAIL"); - delete bit; - delete secondary_bit; + if (bit) + delete bit; + if (secondary_bit) + delete secondary_bit; return; }