list = (char**)PR_Malloc(user_count*sizeof(char*)); users = (struct _SignonUserStruct **) PR_Malloc(user_count*sizeof(si_SignonUserStruct*)); urls = (struct _SignonURLStruct **)PR_Malloc(user_count*sizeof(si_SignonUserStruct*));
list = (PRUnichar**)PR_Malloc(user_count*sizeof(PRUnichar*)); users = (si_SignonUserStruct **) PR_Malloc(user_count*sizeof(si_SignonUserStruct*)); urls = (si_SignonURLStruct **)PR_Malloc(user_count*sizeof(si_SignonUserStruct*));
si_GetURLAndUserForChangeForm(char* password){  si_SignonURLStruct* url;  si_SignonUserStruct* user;  si_SignonDataStruct * data;  PRInt32 user_count;  char ** list;  char ** list2;  si_SignonUserStruct** users;  si_SignonUserStruct** users2;  si_SignonURLStruct** urls;  si_SignonURLStruct** urls2;  /* get count of total number of user nodes at all url nodes */  user_count = 0;  PRInt32 urlCount = LIST_COUNT(si_signon_list);  for (PRInt32 i=0; i<urlCount; i++) {    url = NS_STATIC_CAST(si_SignonURLStruct*, si_signon_list->ElementAt(i));    PRInt32 userCount = LIST_COUNT(url->signonUser_list);    for (PRInt32 ii=0; ii<userCount; ii++) {      user = NS_STATIC_CAST(si_SignonUserStruct*, url->signonUser_list->ElementAt(ii));      user_count++;    }  }  /* allocate lists for maximumum possible url and user names */  list = (char**)PR_Malloc(user_count*sizeof(char*));  users = (struct _SignonUserStruct **) PR_Malloc(user_count*sizeof(si_SignonUserStruct*));  urls = (struct _SignonURLStruct **)PR_Malloc(user_count*sizeof(si_SignonUserStruct*));  list2 = list;  users2 = users;  urls2 = urls;      /* step through set of URLs and users and create list of each */  user_count = 0;  PRInt32 urlCount2 = LIST_COUNT(si_signon_list);  for (PRInt32 i2=0; i2<urlCount2; i2++) {    url = NS_STATIC_CAST(si_SignonURLStruct*, si_signon_list->ElementAt(i2));    PRInt32 userCount = LIST_COUNT(url->signonUser_list);    for (PRInt32 i3=0; i3<userCount; i3++) {      user = NS_STATIC_CAST(si_SignonUserStruct*, url->signonUser_list->ElementAt(i3));      /* find saved password and see if it matches password user just entered */      PRInt32 dataCount = LIST_COUNT(user->signonData_list);      for (PRInt32 i4=0; i4<dataCount; i4++) {        data = NS_STATIC_CAST(si_SignonDataStruct*, user->signonData_list->ElementAt(i4));        if (data->isPassword && !PL_strcmp(data->value, password)) {          /* passwords match so add entry to list */          /* consider first data node to be the identifying item */          data = (si_SignonDataStruct *) (user->signonData_list->ElementAt(0));          *list2 = 0;          StrAllocCopy(*list2, url->URLName);          StrAllocCat(*list2,": ");          StrAllocCat(*list2, data->value);          list2++;          *(users2++) = user;          *(urls2++) = url;          user_count++;          break;        }      }    }  }  /* query user */  PRUnichar * msg = Wallet_Localize("SelectUserWhosePasswordIsBeingChanged");  if (user_count && si_SelectDialog(msg, list, &user_count)) {    user = users[user_count];    url = urls[user_count];    /*     * since this user node is now the most-recently-used one, move it     * to the head of the user list so that it can be favored for     * re-use the next time this form is encountered     */    url->signonUser_list->RemoveElement(user);    url->signonUser_list->InsertElementAt(user, 0);    si_signon_list_changed = PR_TRUE;    si_SaveSignonDataLocked(PR_TRUE);  } else {    user = NULL;  }  Recycle(msg);  /* free allocated strings */  while (--list2 > list) {    PR_Free(*list2);  }  PR_Free(list);  PR_Free(users);  PR_Free(urls);  return user;}