Only delete bitstream objects if non-null

This commit is contained in:
Ricardo Barbedo 2023-02-07 10:30:28 +01:00
parent beb93d8321
commit 090a16656d
1 changed files with 4 additions and 2 deletions

View File

@ -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;
}