Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Unified Diff: ppapi/cpp/websocket.cc

Issue 10905128: Pepper WebSocket API: Fix memory leak issue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: no leak! Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/cpp/var_array_buffer.cc ('k') | ppapi/native_client/src/shared/ppapi_proxy/browser_callback.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/cpp/websocket.cc
diff --git a/ppapi/cpp/websocket.cc b/ppapi/cpp/websocket.cc
index 1fbcaa4ede25eb2c882836a8dbc22b5298dd99bc..f0ae5fa0c30075ddef20cfc14a2f0b65983b0833 100644
--- a/ppapi/cpp/websocket.cc
+++ b/ppapi/cpp/websocket.cc
@@ -70,6 +70,10 @@ int32_t WebSocket::ReceiveMessage(Var* message,
if (!has_interface<PPB_WebSocket_1_0>())
return PP_ERROR_BADRESOURCE;
+ // Initialize |message| to release old internal PP_Var of reused |message|.
+ if (message)
+ *message = Var();
+
return get_interface<PPB_WebSocket_1_0>()->ReceiveMessage(
pp_resource(), const_cast<PP_Var*>(&message->pp_var()),
callback.pp_completion_callback());
« no previous file with comments | « ppapi/cpp/var_array_buffer.cc ('k') | ppapi/native_client/src/shared/ppapi_proxy/browser_callback.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698