Deleting User Picture changes the password of user? I have used following code to delete the user picture on click of a form button element (using #ajax).

function delete_user_picture($form, &amp;$form_state){
  global $user;
  $account = user_load($user-&gt;uid);
  unset($account-&gt;picture);
  $edit = (array) $account;
  user_save($user, $edit);
}


This successfully deletes the picture but also changes the password. How can I prevent it from doing so?

UPDATE:
Based on Molot's Suggestion, I made the following change to code and now it works perfectly:

function profile_delete_user_picture($form, &amp;$form_state){
  global $user;
  $account = user_load($user-&gt;uid);
  $file = file_load($account-&gt;picture-&gt;fid);
  unset($account-&gt;picture);
  $edit = array();
  //add just the picture info and not the whole account info and password won't be changed
  $edit['picture'] = $account-&gt;picture; 
  user_save($user, $edit);
  if ($file != NULL) {
    file_delete($file);
  }
}


Also added code to delete the file from database as per SlakeFistcrunch's Suggestion.
Yes it does. This works as designed, but you made mistake. When you obtain user object, it does not contain a password. It contains a password field, but it's not populated with actual password as it is impossible by design to know it. So you are feeding all fields to user_save, including field for password, but without password in it.