Fixed bug for getClients 26/124926/1
authorkmook <kmook.choi@samsung.com>
Thu, 13 Apr 2017 05:13:32 +0000 (14:13 +0900)
committerkmook <kmook.choi@samsung.com>
Thu, 13 Apr 2017 05:13:32 +0000 (14:13 +0900)
Change-Id: If35f4726311fe5ce65b5d44467522174a362aa96
Signed-off-by: kmook <kmook.choi@samsung.com>
daemon/service_provider/AppCommServiceProvider.cpp

index 801f8a1dd761e698895cc5e0d1643c9596ab5c81..fda572b3dee142a8322439fa2ecdc996663d6e54 100755 (executable)
@@ -350,6 +350,7 @@ int conv::AppCommServiceProvider::readRequest(Request* requestObj)
                                        int cs_index = 0;
 
                                        Client clientObj;
+                                       Json clientListJson;
                                        _D("clients size = %d", client_list->size());
                                        for (auto cs_itr = cl.begin(); cs_itr != cl.end(); cs_itr++) {
                                                cs_index++;
@@ -367,12 +368,10 @@ int conv::AppCommServiceProvider::readRequest(Request* requestObj)
                                                        client.set(NULL, CONV_JSON_CHANNEL_URI, cha->getChannelUri(NULL).c_str());
 
 //                                             result.appendArray(NULL, CONV_JSON_CLIENT_LIST, client);
-                                               char* client_char = client.dupCstr();
-                                               result.set(NULL, CONV_JSON_CLIENT_LIST, client_char);
-                                               if (client_char != NULL) {
-                                                       g_free(client_char);
-                                               }
+                                               clientListJson.appendArray(NULL, CONV_JSON_CLIENT_LIST, client);
+
                                        }
+                                       result.set(NULL, CONV_JSON_CLIENT_LIST, clientListJson.str());
                                        sendReadResponse(result, CONV_JSON_GET_CLIENTS, CONV_ERROR_NONE, svcInfo->registeredRequest);
 
                                        return CONV_ERROR_NONE;