mirror of
https://github.com/Huntereb/Awoo-Installer
synced 2024-11-23 04:03:10 +00:00
Clear buffers after we're done with them in BufferData()
This commit is contained in:
parent
96257eb43a
commit
c9e020da74
2 changed files with 12 additions and 10 deletions
|
@ -8,8 +8,8 @@
|
||||||
#include "data/byte_buffer.hpp"
|
#include "data/byte_buffer.hpp"
|
||||||
#include "data/buffered_placeholder_writer.hpp"
|
#include "data/buffered_placeholder_writer.hpp"
|
||||||
#include "util/usb_util.hpp"
|
#include "util/usb_util.hpp"
|
||||||
#include "error.hpp"
|
#include "util/error.hpp"
|
||||||
#include "debug.h"
|
#include "util/debug.h"
|
||||||
#include "sdInstall.hpp"
|
#include "sdInstall.hpp"
|
||||||
#include "util/util.hpp"
|
#include "util/util.hpp"
|
||||||
#include "util/usb_comms_awoo.h"
|
#include "util/usb_comms_awoo.h"
|
||||||
|
@ -156,8 +156,9 @@ namespace tin::install::nsp
|
||||||
{
|
{
|
||||||
LOG_DEBUG("buffering 0x%lx-0x%lx", offset, offset + size);
|
LOG_DEBUG("buffering 0x%lx-0x%lx", offset, offset + size);
|
||||||
tin::util::USBCmdHeader header = tin::util::USBCmdManager::SendFileRangeCmd(m_nspName, offset, size);
|
tin::util::USBCmdHeader header = tin::util::USBCmdManager::SendFileRangeCmd(m_nspName, offset, size);
|
||||||
u8* ourBuffer = (u8*)memalign(0x1000, header.dataSize);
|
u8* tempBuffer = (u8*)memalign(0x1000, header.dataSize);
|
||||||
if (tin::util::USBRead(ourBuffer, header.dataSize) == 0) THROW_FORMAT("USB transfer timed out or failed");
|
if (tin::util::USBRead(tempBuffer, header.dataSize) == 0) THROW_FORMAT("USB transfer timed out or failed");
|
||||||
memcpy(buf, ourBuffer, header.dataSize);
|
memcpy(buf, tempBuffer, header.dataSize);
|
||||||
|
free(tempBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,8 +8,8 @@
|
||||||
#include "data/byte_buffer.hpp"
|
#include "data/byte_buffer.hpp"
|
||||||
#include "data/buffered_placeholder_writer.hpp"
|
#include "data/buffered_placeholder_writer.hpp"
|
||||||
#include "util/usb_util.hpp"
|
#include "util/usb_util.hpp"
|
||||||
#include "error.hpp"
|
#include "util/error.hpp"
|
||||||
#include "debug.h"
|
#include "util/debug.h"
|
||||||
#include "sdInstall.hpp"
|
#include "sdInstall.hpp"
|
||||||
#include "util/util.hpp"
|
#include "util/util.hpp"
|
||||||
#include "util/usb_comms_awoo.h"
|
#include "util/usb_comms_awoo.h"
|
||||||
|
@ -156,8 +156,9 @@ namespace tin::install::xci
|
||||||
{
|
{
|
||||||
LOG_DEBUG("buffering 0x%lx-0x%lx", offset, offset + size);
|
LOG_DEBUG("buffering 0x%lx-0x%lx", offset, offset + size);
|
||||||
tin::util::USBCmdHeader header = tin::util::USBCmdManager::SendFileRangeCmd(m_xciName, offset, size);
|
tin::util::USBCmdHeader header = tin::util::USBCmdManager::SendFileRangeCmd(m_xciName, offset, size);
|
||||||
u8* ourBuffer = (u8*)memalign(0x1000, header.dataSize);
|
u8* tempBuffer = (u8*)memalign(0x1000, header.dataSize);
|
||||||
if (tin::util::USBRead(ourBuffer, header.dataSize) == 0) THROW_FORMAT("USB transfer timed out or failed");
|
if (tin::util::USBRead(tempBuffer, header.dataSize) == 0) THROW_FORMAT("USB transfer timed out or failed");
|
||||||
memcpy(buf, ourBuffer, header.dataSize);
|
memcpy(buf, tempBuffer, header.dataSize);
|
||||||
|
free(tempBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue