comp-manager: Notify send data result to application
authorSaurav Babu <saurav.babu@samsung.com>
Thu, 29 Mar 2018 10:53:19 +0000 (16:23 +0530)
committersaerome.kim <saerome.kim@samsung.com>
Mon, 2 Jul 2018 10:38:49 +0000 (19:38 +0900)
This patch also fixes memory leaks

Signed-off-by: Saurav Babu <saurav.babu@samsung.com>
src/companion-manager/src/comp_iot.cpp

index 71d617f..a0a6cd5 100644 (file)
@@ -538,25 +538,30 @@ static void _clear_user_data(void *user_data)
                g_free(cmd->arg4);
                cmd->arg4 = NULL;
        }
+
+       g_free(cmd);
+       cmd = NULL;
 }
 
 static void _on_post(const HeaderOptions& /*headerOptions*/,
                                         const OCRepresentation& rep, const int eCode,
                                         void *user_data)
 {
-       last_get_result = eCode;
        int ret;
        try {
                if (eCode == OC_STACK_OK || eCode == OC_STACK_RESOURCE_CREATED ||
                        eCode == OC_STACK_RESOURCE_CHANGED) {
+                       last_get_result = 0;
                        LOG_DEBUG("Post request is successful");
                } else {
+                       last_get_result = eCode;
                        LOG_ERR("_on_post Response error %d", eCode);
                }
        } catch(std::exception& e) {
                LOG_ERR("Exception %s in on post", e.what());
        }
 
+       notify_send_data_finish("RESP_DATA", last_get_result);
        _clear_user_data(user_data);
 }