]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
DW broke the write-clean-logs function with a recent patch that
authorwessels <>
Sat, 9 Dec 2000 07:35:01 +0000 (07:35 +0000)
committerwessels <>
Sat, 9 Dec 2000 07:35:01 +0000 (07:35 +0000)
wanted to fix a memory leak.  I was passing a NULL pathname
to open().

src/fs/aufs/store_dir_aufs.cc
src/fs/coss/store_dir_coss.cc
src/fs/diskd/store_dir_diskd.cc
src/fs/ufs/store_dir_ufs.cc

index 372f8e1780a6f568fcc0dbf31afb14ac0574db55..6c57d6fefceaff5f526163699f24b258dddad39e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir_aufs.cc,v 1.20 2000/12/05 09:11:30 wessels Exp $
+ * $Id: store_dir_aufs.cc,v 1.21 2000/12/09 00:35:01 wessels Exp $
  *
  * DEBUG: section 47    Store Directory Routines
  * AUTHOR: Duane Wessels
@@ -971,13 +971,14 @@ storeAufsDirWriteCleanStart(SwapDir * sd)
     struct stat sb;
     sd->log.clean.write = NULL;
     sd->log.clean.state = NULL;
+    state->new = xstrdup(storeAufsDirSwapLogFile(sd, ".clean"));
     state->fd = file_open(state->new, O_WRONLY | O_CREAT | O_TRUNC);
     if (state->fd < 0) {
+       xfree(state->new);
        xfree(state);
        return -1;
     }
     state->cur = xstrdup(storeAufsDirSwapLogFile(sd, NULL));
-    state->new = xstrdup(storeAufsDirSwapLogFile(sd, ".clean"));
     state->cln = xstrdup(storeAufsDirSwapLogFile(sd, ".last-clean"));
     state->outbuf = xcalloc(CLEAN_BUF_SZ, 1);
     state->outbuf_offset = 0;
index dc876ae987ac076aa9e010e76177cee69db31e75..142be65d87649cf5c356758e0be23348021083db 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir_coss.cc,v 1.11 2000/12/05 09:11:31 wessels Exp $
+ * $Id: store_dir_coss.cc,v 1.12 2000/12/09 00:35:04 wessels Exp $
  *
  * DEBUG: section 81    Store COSS Directory Routines
  * AUTHOR: Eric Stern
@@ -467,15 +467,16 @@ storeCossDirWriteCleanStart(SwapDir * sd)
     CossInfo *cs = (CossInfo *) sd->fsdata;
     struct _clean_state *state = xcalloc(1, sizeof(*state));
     struct stat sb;
+    state->new = xstrdup(storeCossDirSwapLogFile(sd, ".clean"));
     state->fd = file_open(state->new, O_WRONLY | O_CREAT | O_TRUNC);
     if (state->fd < 0) {
+       xfree(state->new);
        xfree(state);
        return -1;
     }
     sd->log.clean.write = NULL;
     sd->log.clean.state = NULL;
     state->cur = xstrdup(storeCossDirSwapLogFile(sd, NULL));
-    state->new = xstrdup(storeCossDirSwapLogFile(sd, ".clean"));
     state->cln = xstrdup(storeCossDirSwapLogFile(sd, ".last-clean"));
     state->outbuf = xcalloc(CLEAN_BUF_SZ, 1);
     state->outbuf_offset = 0;
index 020dce40e443d42c3665b7d7681a29e2c8811e60..e95564a2fa66a1f224d072e9b5c698c2751b61a6 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir_diskd.cc,v 1.27 2000/12/05 09:11:31 wessels Exp $
+ * $Id: store_dir_diskd.cc,v 1.28 2000/12/09 00:35:04 wessels Exp $
  *
  * DEBUG: section 47    Store Directory Routines
  * AUTHOR: Duane Wessels
@@ -1162,13 +1162,14 @@ storeDiskdDirWriteCleanStart(SwapDir * sd)
     struct stat sb;
     sd->log.clean.write = NULL;
     sd->log.clean.state = NULL;
+    state->new = xstrdup(storeDiskdDirSwapLogFile(sd, ".clean"));
     state->fd = file_open(state->new, O_WRONLY | O_CREAT | O_TRUNC);
     if (state->fd < 0) {
+       xfree(state->new);
        xfree(state);
        return -1;
     }
     state->cur = xstrdup(storeDiskdDirSwapLogFile(sd, NULL));
-    state->new = xstrdup(storeDiskdDirSwapLogFile(sd, ".clean"));
     state->cln = xstrdup(storeDiskdDirSwapLogFile(sd, ".last-clean"));
     state->outbuf = xcalloc(CLEAN_BUF_SZ, 1);
     state->outbuf_offset = 0;
index a7fd5ab9ad8413940a456b66cfc41e2d41b5161a..3e47b1138eda69367653cc0217c252efffb04e79 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir_ufs.cc,v 1.17 2000/12/05 09:11:34 wessels Exp $
+ * $Id: store_dir_ufs.cc,v 1.18 2000/12/09 00:35:05 wessels Exp $
  *
  * DEBUG: section 47    Store Directory Routines
  * AUTHOR: Duane Wessels
@@ -969,13 +969,14 @@ storeUfsDirWriteCleanStart(SwapDir * sd)
     struct stat sb;
     sd->log.clean.write = NULL;
     sd->log.clean.state = NULL;
+    state->new = xstrdup(storeUfsDirSwapLogFile(sd, ".clean"));
     state->fd = file_open(state->new, O_WRONLY | O_CREAT | O_TRUNC);
     if (state->fd < 0) {
+       xfree(state->new);
        xfree(state);
        return -1;
     }
     state->cur = xstrdup(storeUfsDirSwapLogFile(sd, NULL));
-    state->new = xstrdup(storeUfsDirSwapLogFile(sd, ".clean"));
     state->cln = xstrdup(storeUfsDirSwapLogFile(sd, ".last-clean"));
     state->outbuf = xcalloc(CLEAN_BUF_SZ, 1);
     state->outbuf_offset = 0;