memory leak in krb5_read_password
authorKen Raeburn <raeburn@mit.edu>
Sun, 13 Apr 2003 10:40:03 +0000 (10:40 +0000)
committerKen Raeburn <raeburn@mit.edu>
Sun, 13 Apr 2003 10:40:03 +0000 (10:40 +0000)
* read_pwd.c (krb5_read_password): Always free temporary storage used for
verification version of password.

ticket: new
target_version: 1.3
tags: pullup

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15348 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/os/ChangeLog
src/lib/krb5/os/read_pwd.c

index 51638d9e44c9833a61bfa4ab48873723682a5107..f3406c5b0390af7564a7030067cb7f84064a0c74 100644 (file)
@@ -1,3 +1,8 @@
+2003-04-13  Ken Raeburn  <raeburn@mit.edu>
+
+       * read_pwd.c (krb5_read_password): Always free temporary storage
+       used for verification version of password.
+
 2003-03-06  Alexandra Ellwood <lxs@mit.edu>
 
     * c_ustime.c: Removed Mac OS 9 code.
index 9023b8e98747dcf5b077ad5c0b83019872fba5c9..1bb631c6ae53c989fab7373c05a8f8d0908c363f 100644 (file)
@@ -64,15 +64,12 @@ krb5_read_password(krb5_context context, const char *prompt, const char *prompt2
            return ENOMEM;
        retval = krb5_prompter_posix(NULL,
                                     NULL,NULL, NULL, 1, &k5prompt);
-       if (retval) {
-           free(verify_data.data);
-       } else {
+       if (retval == 0) {
            /* compare */
-           if (strncmp(return_pwd, (char *)verify_data.data, *size_return)) {
+           if (strncmp(return_pwd, (char *)verify_data.data, *size_return))
                retval = KRB5_LIBOS_BADPWDMATCH;
-               free(verify_data.data);
-           }
        }
+       free(verify_data.data);
     }
     if (!retval)
        *size_return = k5prompt.reply->length;