Fix static analysis issue 81/282081/1
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 27 Sep 2022 02:08:15 +0000 (02:08 +0000)
committerHwankyu Jhun <h.jhun@samsung.com>
Tue, 27 Sep 2022 02:08:15 +0000 (02:08 +0000)
This patch fixes 'use after free' case. The bundle instance is moved
using std::move().

Change-Id: I3e00efdb42038c1a324e3a687678829e6a5b3eaa
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/app_com.cc

index 6b78bf7..307534b 100644 (file)
@@ -326,8 +326,8 @@ extern "C" API int aul_app_com_send(const char* endpoint, bundle* envelope) {
       .With(std::move(b))
       .SendSimply();
   if (type != BUNDLE_TYPE_NONE) {
-    b.Delete(AUL_K_COM_ENDPOINT);
-    b.Add(AUL_K_COM_ENDPOINT, com_endpoint);
+    bundle_del(envelope, AUL_K_COM_ENDPOINT);
+    bundle_add_str(envelope, AUL_K_COM_ENDPOINT, com_endpoint.c_str());
   }
 
   return ret;