diff --git a/fpga/lib/ips/emc.cpp b/fpga/lib/ips/emc.cpp index 6b0ccf2fb..c4eeabba5 100644 --- a/fpga/lib/ips/emc.cpp +++ b/fpga/lib/ips/emc.cpp @@ -113,13 +113,10 @@ EMC::flash(uint32_t offset, uint32_t length, uint8_t *data) int ret = XST_FAILURE; uint32_t start = offset; - uint8_t *verify_data = new uint8_t[length]; - /* Reset the Flash Device. This clears the ret registers and puts * the device in Read mode. */ ret = XFlash_Reset(&xflash); if (ret != XST_SUCCESS){ - delete[] verify_data; return false; } @@ -131,26 +128,24 @@ EMC::flash(uint32_t offset, uint32_t length, uint8_t *data) (xflash.CommandSet == XFL_CMDSET_INTEL_G18)) { ret = XFlash_Unlock(&xflash, offset, 0); if(ret != XST_SUCCESS){ - delete[] verify_data; return false; } } // Perform the Erase operation. ret = XFlash_Erase(&xflash, start, length); - if (ret != XST_SUCCESS){ - delete[] verify_data; + if (ret != XST_SUCCESS){; return false; } // Perform the Write operation. ret = XFlash_Write(&xflash, start, length, data); if (ret != XST_SUCCESS){ - delete[] verify_data; return false; } // Perform the read operation. + uint8_t *verify_data = new uint8_t[length]; ret = XFlash_Read(&xflash, start, length, verify_data); if(ret != XST_SUCCESS) { delete[] verify_data;