crypto: fix return Local Handle w/o scope.Close()
authorTrevor Norris <trev.norris@gmail.com>
Wed, 17 Apr 2013 18:45:13 +0000 (11:45 -0700)
committerBen Noordhuis <info@bnoordhuis.nl>
Wed, 17 Apr 2013 23:30:36 +0000 (01:30 +0200)
A new String was being created and returned, but was not sent through
the scope.Close(), which caused it to be cleaned up before being
returned.

src/node_crypto.cc

index 4a02812..667f1e3 100644 (file)
@@ -1962,7 +1962,8 @@ Handle<Value> Connection::GetNegotiatedProto(const Arguments& args) {
       return False();
     }
 
-    return String::New((const char*) npn_proto, npn_proto_len);
+    return scope.Close(String::New(reinterpret_cast<const char*>(npn_proto),
+                                   npn_proto_len));
   } else {
     return ss->selectedNPNProto_;
   }