]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
(_gnutls_psk_pwd_find_entry): Call fclose after fopen.
authorSimon Josefsson <simon@josefsson.org>
Thu, 3 Apr 2008 07:52:07 +0000 (09:52 +0200)
committerSimon Josefsson <simon@josefsson.org>
Thu, 3 Apr 2008 07:52:07 +0000 (09:52 +0200)
Tiny patch from Laurence Withers <l@lwithers.me.uk>, see
<http://lists.gnu.org/archive/html/gnutls-devel/2008-04/msg00002.html>.

lib/auth_psk_passwd.c

index 0c3281d3e155ac7102784de1ba2a0c3803812415..65891878c7bd243e7cd95cb8258f633c50aea894 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2007 Free Software Foundation
+ * Copyright (C) 2005, 2007, 2008 Free Software Foundation
  *
  * Author: Nikos Mavrogiannopoulos
  *
@@ -197,6 +197,7 @@ _gnutls_psk_pwd_find_entry (gnutls_session_t session, char *username,
       if (strncmp (username, line, MAX (i, len)) == 0)
        {
          ret = pwd_put_values (psk, line);
+         fclose (fd);
          if (ret < 0)
            {
              gnutls_assert ();
@@ -205,6 +206,7 @@ _gnutls_psk_pwd_find_entry (gnutls_session_t session, char *username,
          return 0;
        }
     }
+  fclose (fd);
 
   /* user was not found. Fake him. 
    * the last index found and randomize the entry.