summaryrefslogtreecommitdiffhomepage
path: root/loginutils/passwd.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-04-07 15:50:30 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2018-04-07 15:50:30 +0200
commit17058a06c4333fc0c492c168c8a971ebd0fd5a5a (patch)
treea32133b2e5c18be65796283177551f9bcd7e49bb /loginutils/passwd.c
parentbae8fc4436f9aeb43ef0aaccd1c9b1b35b5a4617 (diff)
libbb: switch bb_ask_noecho() to "mallocing" string return API
function old new delta bb_ask_noecho 313 330 +17 get_cred_or_die 125 115 -10 passwd_main 995 958 -37 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 17/-47) Total: -30 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'loginutils/passwd.c')
-rw-r--r--loginutils/passwd.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/loginutils/passwd.c b/loginutils/passwd.c
index 02303b575..d0408d8b4 100644
--- a/loginutils/passwd.c
+++ b/loginutils/passwd.c
@@ -65,11 +65,9 @@ static char* new_password(const struct passwd *pw, uid_t myuid, const char *algo
if (ENABLE_FEATURE_CLEAN_UP)
free(encrypted);
}
- orig = xstrdup(orig); /* or else bb_ask_noecho_stdin() will destroy it */
newp = bb_ask_noecho_stdin("New password: "); /* returns ptr to static */
if (!newp)
goto err_ret;
- newp = xstrdup(newp); /* we are going to bb_ask_noecho_stdin() again, so save it */
if (ENABLE_FEATURE_PASSWD_WEAK_CHECK
&& obscure(orig, newp, pw)
&& myuid != 0
@@ -99,6 +97,7 @@ static char* new_password(const struct passwd *pw, uid_t myuid, const char *algo
if (ENABLE_FEATURE_CLEAN_UP) free(newp);
nuke_str(cp);
+ if (ENABLE_FEATURE_CLEAN_UP) free(cp);
return ret;
}