Make sure memory associated the credentials cache is freed after the
authorTheodore Tso <tytso@mit.edu>
Fri, 23 Sep 1994 01:39:18 +0000 (01:39 +0000)
committerTheodore Tso <tytso@mit.edu>
Fri, 23 Sep 1994 01:39:18 +0000 (01:39 +0000)
cache is destroyed.

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

src/lib/krb5/ccache/file/ChangeLog
src/lib/krb5/ccache/file/fcc_destry.c
src/lib/krb5/ccache/stdio/ChangeLog
src/lib/krb5/ccache/stdio/scc_destry.c

index 97748b5d21bfb174ec0095615a693f1573dbd40d..cc2628fbab30618995fd57bc77e3a5785e263260 100644 (file)
@@ -1,3 +1,8 @@
+Thu Sep 22 21:37:15 1994  Theodore Y. Ts'o  (tytso@dcl)
+
+       * fcc_destry.c (krb5_fcc_destroy): Make sure memory associated
+               with the credentials cache is freed after it is destroyed.
+
 Thu Aug 18 16:33:33 1994  Theodore Y. Ts'o  (tytso at tsx-11)
 
        * fcc_retrv.c (srvname_match): Fix bug in srvname_match where so
index be385c0af2949d3a15c119549148d73d5f7b7818..1433346f8746a54908dbe9206275f8cab96ed1c6 100644 (file)
@@ -45,8 +45,10 @@ krb5_error_code krb5_fcc_destroy(id)
      
      if (OPENCLOSE(id)) {
          ret = open(((krb5_fcc_data *) id->data)->filename, O_RDWR, 0);
-         if (ret < 0)
-              return krb5_fcc_interpret(errno);
+         if (ret < 0) {
+             ret = krb5_fcc_interpret(errno);
+             goto cleanup;
+         }
          ((krb5_fcc_data *) id->data)->fd = ret;
      }
      else
@@ -59,7 +61,7 @@ krb5_error_code krb5_fcc_destroy(id)
             (void) close(((krb5_fcc_data *)id->data)->fd);
             ((krb5_fcc_data *) id->data)->fd = -1;
         }
-        return ret;
+        goto cleanup;
      }
      
      ret = fstat(((krb5_fcc_data *) id->data)->fd, &buf);
@@ -69,7 +71,7 @@ krb5_error_code krb5_fcc_destroy(id)
             (void) close(((krb5_fcc_data *)id->data)->fd);
             ((krb5_fcc_data *) id->data)->fd = -1;
         }
-        return ret;
+        goto cleanup;
      }
 
      /* XXX This may not be legal XXX */
@@ -83,7 +85,7 @@ krb5_error_code krb5_fcc_destroy(id)
                  (void) close(((krb5_fcc_data *)id->data)->fd);
                  ((krb5_fcc_data *) id->data)->fd = -1;
              }
-             return ret;
+             goto cleanup;
          }
 
      if (write(((krb5_fcc_data *) id->data)->fd, zeros, size % BUFSIZ) < 0) {
@@ -92,7 +94,7 @@ krb5_error_code krb5_fcc_destroy(id)
             (void) close(((krb5_fcc_data *)id->data)->fd);
             ((krb5_fcc_data *) id->data)->fd = -1;
         }
-        return ret;
+        goto cleanup;
      }
 
      ret = close(((krb5_fcc_data *) id->data)->fd);
@@ -101,5 +103,10 @@ krb5_error_code krb5_fcc_destroy(id)
      if (ret)
         ret = krb5_fcc_interpret(errno);
 
+  cleanup:
+     xfree(((krb5_fcc_data *) id->data)->filename);
+     xfree(id->data);
+     xfree(id);
+
      return ret;
 }
index 56d6d4fb3b4c302116f76a685cf9730bf3ffe527..b7976942b2995c0f190f47237b483054dc3e6e9e 100644 (file)
@@ -1,3 +1,8 @@
+Thu Sep 22 21:38:09 1994  Theodore Y. Ts'o  (tytso@dcl)
+
+       * scc_destry.c (krb5_scc_destroy): Make sure memory associated
+               with the credentials cache is freed after it is destroyed.
+
 Thu Aug 18 16:34:51 1994  Theodore Y. Ts'o  (tytso at tsx-11)
 
        * scc_retrv.c (srvname_match): Fix bug in srvname_match where so
index 1691692ddf9909f267046a20ebf7264cdb114f5f..4555c6f4b8941f1608008f810262e3019f8457d0 100644 (file)
@@ -61,7 +61,7 @@ krb5_error_code krb5_scc_destroy(id)
             (void) fclose(data->file);
             data->file = 0;
         }
-        return ret;
+        goto cleanup;
      }
 
 #if 0
@@ -77,7 +77,7 @@ krb5_error_code krb5_scc_destroy(id)
             (void) fclose(data->file);
             data->file = 0;
         }
-        return ret;
+        goto cleanup;
      }
 
      /* XXX This may not be legal XXX */
@@ -91,7 +91,7 @@ krb5_error_code krb5_scc_destroy(id)
                  (void) fclose(data->file);
                  data->file = 0;
              }
-             return ret;
+             goto cleanup;
          }
 
      if (fwrite(data->file, zeros, size % BUFSIZ) < 0) {
@@ -100,7 +100,7 @@ krb5_error_code krb5_scc_destroy(id)
             (void) fclose(data->file);
             data->file = 0;
         }
-        return ret;
+        goto cleanup;
      }
      
      ret = fclose(data->file);
@@ -110,5 +110,10 @@ krb5_error_code krb5_scc_destroy(id)
      if (ret)
         ret = krb5_scc_interpret(errno);
 
+  cleanup:
+     xfree(data->filename);
+     xfree(data);
+     xfree(id);
+
      return ret;
 }