From 54b958436a01b6ceb70e455a886e9dcaa9a5574b Mon Sep 17 00:00:00 2001 From: Don Neufeld Date: Tue, 1 Apr 2014 19:05:17 -0700 Subject: [PATCH] Added protection against multiple callback invocation on error path --- lib/oauth.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/oauth.js b/lib/oauth.js index b4873b2..4c0e911 100644 --- a/lib/oauth.js +++ b/lib/oauth.js @@ -405,8 +405,10 @@ exports.OAuth.prototype._performSecureRequest= function( oauth_token, oauth_toke }); request.on("error", function(err) { - callbackCalled= true; - callback( err ) + if(!callbackCalled) { + callbackCalled= true; + callback( err ) + } }); if( (method == "POST" || method =="PUT") && post_body != null && post_body != "" ) {