1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-23 04:12:02 +00:00

erpt: fix 0x100 byte memory leak on creation of new report

This commit is contained in:
Michael Scire 2021-06-28 17:36:42 -07:00
parent e086022b77
commit c362838e11
2 changed files with 4 additions and 1 deletions

View file

@ -94,6 +94,9 @@ namespace ams::erpt::srv {
}
if (data_size > 0) {
/* If array buffer isn't nullptr, we'll leak memory here, so verify that it is. */
AMS_ABORT_UNLESS(this->ctx.array_buffer == nullptr);
this->ctx.array_buffer = static_cast<u8 *>(AllocateWithAlign(data_size, alignof(u64)));
R_UNLESS(this->ctx.array_buffer != nullptr, erpt::ResultOutOfMemory());

View file

@ -409,7 +409,7 @@ namespace ams::erpt::srv {
Result Reporter::CreateReport(ReportType type, Result ctx_result, const ContextEntry *ctx, const u8 *data, u32 data_size, const ReportMetaData *meta, const AttachmentId *attachments, u32 num_attachments) {
/* Create a context record for the report. */
auto record = std::make_unique<ContextRecord>(CategoryId_ErrorInfoAuto);
auto record = std::make_unique<ContextRecord>();
R_UNLESS(record != nullptr, erpt::ResultOutOfMemory());
/* Initialize the record. */