Fix coverity #900. Resource leak.
authorJeremy Allison <jra@samba.org>
Fri, 19 Jun 2009 23:44:15 +0000 (16:44 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 19 Jun 2009 23:44:15 +0000 (16:44 -0700)
Jeremy.

source3/utils/smbpasswd.c

index c0b2cac18a106bce399797d37be54492cad5618d..7957dd8a62a5250401336ae1b81a74aaea68ea83 100644 (file)
@@ -398,6 +398,10 @@ static int process_root(int local_flags)
 
                if (remote_machine != NULL) {
                        old_passwd = get_pass("Old SMB password:",stdin_passwd_get);
+                       if(!old_passwd) {
+                               fprintf(stderr, "Unable to get old password.\n");
+                               exit(1);
+                       }
                }
 
                if (!(local_flags & LOCAL_SET_PASSWORD)) {
@@ -478,6 +482,7 @@ static int process_root(int local_flags)
        }
 
  done:
+       SAFE_FREE(old_passwd);
        SAFE_FREE(new_passwd);
        return result;
 }