Diff

Differences From Artifact [ce1d3f96e0]:

To Artifact [9641a2fef0]:


    87     87   			}
    88     88   
    89     89   			/*
    90     90   			 * Send the reply back to the requestor, hopefully they are waiting for this message
    91     91   			 */
    92     92   			PostMessage(*reply);
    93     93   
           94  +			delete message;
           95  +
    94     96   			return;
    95     97   		}
    96     98   
    97     99   		virtual void HandleMessage(const pp::Var& messagePlain) {
    98    100   			pp::VarDictionary *message;
    99    101   			pp::Var target;
   100    102   
   101    103   			/*
   102    104   			 * The incoming message must be a dictionary
   103    105   			 */
   104    106   			if (!messagePlain.is_dictionary()) {
          107  +				pcscNaClHandleMessage(messagePlain);
          108  +
   105    109   				return;
   106    110   			}
   107    111   
   108    112   			/*
   109    113   			 * Process the appropriate command from the incoming message
   110    114   			 */
   111    115   			message = new pp::VarDictionary(messagePlain);
   112    116   
   113    117   			/*
   114    118   			 * Verify that this message is destined for us
   115    119   			 */
   116    120   			if (!message->HasKey("target")) {
          121  +				delete message;
          122  +
          123  +				pcscNaClHandleMessage(messagePlain);
          124  +
   117    125   				return;
   118    126   			}
   119    127   
   120    128   			target = message->Get("target");
   121    129   			if (target.AsString() != "cackey") {
          130  +				delete message;
          131  +
          132  +				pcscNaClHandleMessage(messagePlain);
          133  +
   122    134   				return;
   123    135   			}
   124    136   
   125    137   			/*
   126    138   			 * Determine what we are being asked to do
   127    139   			 */
   128    140   			if (!message->HasKey("command")) {
          141  +				delete message;
          142  +
          143  +				pcscNaClHandleMessage(messagePlain);
          144  +
   129    145   				return;
   130    146   			}
   131    147   
   132    148   			/*
   133    149   			 * Process the request in another thread
   134    150   			 */
   135    151   			std::thread(&CACKeyInstance::HandleMessageThread, this, message).detach();