fix openclose stuff
authorJohn Kohl <jtkohl@mit.edu>
Tue, 1 May 1990 17:03:09 +0000 (17:03 +0000)
committerJohn Kohl <jtkohl@mit.edu>
Tue, 1 May 1990 17:03:09 +0000 (17:03 +0000)
use xfree

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

src/lib/krb5/ccache/file/fcc_close.c
src/lib/krb5/ccache/file/fcc_destry.c
src/lib/krb5/ccache/file/fcc_eseq.c

index 4a6a39053935ec4c10ecbc4fa88c179f34d55557..4c53421c2e96422f693bb05978f7e18b8f3e134a 100644 (file)
@@ -11,7 +11,7 @@
  */
 
 #if !defined(lint) && !defined(SABER)
-static char fcc_resolve_c[] = "$Id$";
+static char fcc_close_c[] = "$Id$";
 #endif /* !lint && !SABER */
 
 #include <krb5/copyright.h>
@@ -30,12 +30,13 @@ krb5_error_code
 krb5_fcc_close(id)
    krb5_ccache id;
 {
-     if (OPENCLOSE(id))
+     if (OPENCLOSE(id)) {
         close(((krb5_fcc_data *) id->data)->fd);
-     
-     free(((krb5_fcc_data *) id->data)->filename);
-     free(((krb5_fcc_data *) id->data));
-     free(id);
+        ((krb5_fcc_data *) id->data)->fd = -1;
+     }
+     xfree(((krb5_fcc_data *) id->data)->filename);
+     xfree(((krb5_fcc_data *) id->data));
+     xfree(id);
 
      return KRB5_OK;
 }
index 23c9a88cc588d11055d1e6af7fdcbd46ea379a46..e8f6938eace1ad65b71a9ee6db8c4efee0f494fd 100644 (file)
@@ -34,10 +34,10 @@ krb5_error_code krb5_fcc_destroy(id)
      int ret, i;
      
      if (OPENCLOSE(id)) {
-         ((krb5_fcc_data *) id->data)->fd = open(((krb5_fcc_data *) id->data)
-                                                 ->filename, O_RDWR, 0);
-         if (((krb5_fcc_data *) id->data)->fd < 0)
+         ret = open(((krb5_fcc_data *) id->data)->filename, O_RDWR, 0);
+         if (ret < 0)
               return errno;
+         ((krb5_fcc_data *) id->data)->fd = ret;
      }
      else
          lseek(((krb5_fcc_data *) id->data)->fd, 0, L_SET);
index 7f9db3c104217f4a0bbf59e436eeebea706135cb..95c97c98efe2d79fd326c595b783d7bb986f06fc 100644 (file)
@@ -35,10 +35,12 @@ krb5_fcc_end_seq_get(id, cursor)
    krb5_ccache id;
    krb5_cc_cursor *cursor;
 {
-     if (OPENCLOSE(id))
+     if (OPENCLOSE(id)) {
          close(((krb5_fcc_data *) id->data)->fd);
+         ((krb5_fcc_data *) id->data)->fd = -1;
+     }
 
-     free((krb5_fcc_cursor *) *cursor);
+     xfree((krb5_fcc_cursor *) *cursor);
 
      return KRB5_OK;
 }