Fix crash issue related string reference in std::thread exec
authorjihwan.seo <jihwan.seo@samsung.com>
Mon, 20 Mar 2017 11:56:52 +0000 (20:56 +0900)
committerDan Mihai <Daniel.Mihai@microsoft.com>
Fri, 24 Mar 2017 21:23:11 +0000 (21:23 +0000)
Change-Id: I24947070a50e787dabeadb8e15192eb68b687944
Signed-off-by: jihwan.seo <jihwan.seo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/18005
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
resource/src/InProcClientWrapper.cpp

index 5c4ce32..be36651 100644 (file)
@@ -448,8 +448,9 @@ namespace OC
             oclog() << "listenResListWithErrorCallback(): failed to create resource. clientResponse: "
                     << result << std::flush;
 
-             //send the error callback
-            std::thread exec(context->errorCallback, clientResponse->resourceUri, result);
+            //send the error callback
+            std::string uri = clientResponse->resourceUri;
+            std::thread exec(context->errorCallback, uri, result);
             exec.detach();
             return OC_STACK_KEEP_TRANSACTION;
         }