Fix bugs of C Generator 70/261370/3
authorHwankyu Jhun <h.jhun@samsung.com>
Fri, 16 Jul 2021 06:00:58 +0000 (15:00 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Fri, 16 Jul 2021 06:36:50 +0000 (15:36 +0900)
The exception handling of getter is wrong. The function has to release
the allocated memory if Out-of-Memory error occurs.

Change-Id: I799f3ad9424210c0cae10973523f2022614c4cf0
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
idlc/gen/c_body_gen_base.cc

index f555c26..8d1273e 100644 (file)
@@ -904,8 +904,8 @@ std::string CBodyGeneratorBase::GetGetterString(const std::string& id,
                 [&]()->std::string {
                   std::string r;
                   r += "_E(\"Failed to clone " + id + "\");" + NLine(1);
-                  r += GetFinalizeString(id, type, "h->") + NLine(1);
-                  r += GetSetterString("h->" + id, "NULL") + NLine(1);
+                  r += GetFinalizeString("*" + id, type, "") + NLine(1);
+                  r += GetSetterString("*" + id, "NULL") + NLine(1);
                   r += "return -1;";
                   return r;
                 });