[Project_owners] clearing variables

Neil neil at parkwaycc.co.uk
Tue Feb 7 09:12:31 EST 2006


Eric H. Jung wrote:

>With your comments in mind, I've written this function:
>
>var PwdMkr_MPW = {
>
>  // Recursively delete sensitive data
>  wipe : function(o) {
>    if (o) {
>      for (var i in o)
>        this.wipe(o[i]);
>      delete o;
>    }
>  },
>  
>
delete o; will only delete your local variable, so this is just an 
inefficient way of doing nothing. Perhaps you meant this:
function wipe(o) {
  for (var i in o) {
    var m = o[i];
    delete o[i];
    if (typeof m == "object")
      wipe(m);
  }
}


More information about the Project_owners mailing list