Fixed Memory Leak in R2DecDecompiler::decompileAt (#2257)

This commit is contained in:
NIRMAL MANOJ C 2020-06-20 15:36:13 +05:30 committed by GitHub
parent d33eae4cb9
commit d26e48f3f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,14 +57,14 @@ void R2DecDecompiler::decompileAt(RVA addr)
if (lineObject.isEmpty()) {
continue;
}
RCodeAnnotation *annotationi = new RCodeAnnotation;
annotationi->start = codeString.length();
RCodeAnnotation annotationi = { 0 };
annotationi.start = codeString.length();
codeString.append(lineObject["str"].toString() + "\n");
annotationi->end = codeString.length();
annotationi.end = codeString.length();
bool ok;
annotationi->type = R_CODE_ANNOTATION_TYPE_OFFSET;
annotationi->offset.offset = lineObject["offset"].toVariant().toULongLong(&ok);
r_annotated_code_add_annotation(code, annotationi);
annotationi.type = R_CODE_ANNOTATION_TYPE_OFFSET;
annotationi.offset.offset = lineObject["offset"].toVariant().toULongLong(&ok);
r_annotated_code_add_annotation(code, &annotationi);
}
for (const auto &line : json["errors"].toArray()) {