From 280e9279ec022af02d0e94804bee2eeb66ba0a00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Cottinet?= Date: Fri, 22 Mar 2019 11:32:09 +0100 Subject: [PATCH] [c++] fix a bad memleak snippet example (#264) # Description Solve a code snippet resulting in a dangling pointer. --- src/sdk-reference/cpp/1/kuzzle/getters/snippets/getters.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sdk-reference/cpp/1/kuzzle/getters/snippets/getters.cpp b/src/sdk-reference/cpp/1/kuzzle/getters/snippets/getters.cpp index 5d46edd80..8f0441f4b 100644 --- a/src/sdk-reference/cpp/1/kuzzle/getters/snippets/getters.cpp +++ b/src/sdk-reference/cpp/1/kuzzle/getters/snippets/getters.cpp @@ -1,5 +1,5 @@ -kuzzleio::Kuzzle *kuzzle = new kuzzleio::Kuzzle( - new kuzzleio::WebSocket("kuzzle")); +kuzzleio::WebSocket *ws = new kuzzleio::WebSocket("kuzzle"); +kuzzleio::Kuzzle *kuzzle = new kuzzleio::Kuzzle(ws); std::string jwt_token = kuzzle->jwt(); @@ -21,4 +21,4 @@ bool auto_reconnect = kuzzle->autoReconnect(); bool auto_replay = kuzzle->autoReplay(); -bool auto_resubscribe = kuzzle->autoResubscribe(); \ No newline at end of file +bool auto_resubscribe = kuzzle->autoResubscribe();