Skip to content
This repository was archived by the owner on Nov 28, 2018. It is now read-only.

Commit 749b05f

Browse files
committed
make sure every variable is defined before use it, avoid from global leaks
1 parent 4184d0d commit 749b05f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/stomp.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var net = require('net'),
3131

3232
function parse_command(data) {
3333
var command,
34-
this_string = data.toString('utf8', start=0, end=data.length);
34+
this_string = data.toString('utf8', 0, data.length);
3535
command = this_string.split('\n');
3636
return command[0];
3737
};
@@ -70,9 +70,9 @@ function parse_frame(chunk) {
7070

7171
command = parse_command(chunk);
7272
data = chunk.slice(command.length + 1, chunk.length);
73-
data = data.toString('utf8', start=0, end=data.length);
73+
data = data.toString('utf8', 0, data.length);
7474

75-
the_rest = data.split('\n\n');
75+
var the_rest = data.split('\n\n');
7676
headers = parse_headers(the_rest[0]);
7777
body = the_rest.slice(1, the_rest.length);
7878

@@ -301,7 +301,7 @@ Stomp.prototype.disconnect = function() {
301301
*/
302302
Stomp.prototype.subscribe = function(headers) {
303303
var self = this;
304-
destination = headers['destination'];
304+
var destination = headers['destination'];
305305
headers['session'] = self.session;
306306
send_command(this, 'SUBSCRIBE', headers);
307307
self._subscribed_to[destination] = true;
@@ -314,7 +314,7 @@ Stomp.prototype.subscribe = function(headers) {
314314
*/
315315
Stomp.prototype.unsubscribe = function(headers) {
316316
var self = this;
317-
destination = headers['destination'];
317+
var destination = headers['destination'];
318318
headers['session'] = self.session;
319319
send_command(this, 'UNSUBSCRIBE', headers);
320320
self._subscribed_to[destination] = false;
@@ -371,7 +371,7 @@ Stomp.prototype.abort = function(transaction_id) {
371371
*/
372372
Stomp.prototype.send = function(headers, want_receipt) {
373373
var self = this;
374-
destination = headers['destination'];
374+
var destination = headers['destination'];
375375
body = headers['body'] || null;
376376
delete headers['body'];
377377
headers['session'] = self.session;

0 commit comments

Comments
 (0)