From d26e48f3f5c9d67d01862eb376d01575bd2cd504 Mon Sep 17 00:00:00 2001
From: NIRMAL MANOJ C <nimmumanoj@gmail.com>
Date: Sat, 20 Jun 2020 15:36:13 +0530
Subject: [PATCH] Fixed Memory Leak in R2DecDecompiler::decompileAt (#2257)

---
 src/common/Decompiler.cpp | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/common/Decompiler.cpp b/src/common/Decompiler.cpp
index 6ce33d15..40b8a67b 100644
--- a/src/common/Decompiler.cpp
+++ b/src/common/Decompiler.cpp
@@ -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()) {