]> mj.ucw.cz Git - libucw.git/commitdiff
Logging: log_new_file() keeps its own copy of the path.
authorMartin Mares <mj@ucw.cz>
Fri, 13 Feb 2009 23:04:07 +0000 (00:04 +0100)
committerMartin Mares <mj@ucw.cz>
Fri, 13 Feb 2009 23:04:07 +0000 (00:04 +0100)
ucw/log-file.c

index 65418a29d16d39de40a7d679a891dde3af50f8b3..6a060baa446686dd05af76646b218aa46c60231c 100644 (file)
@@ -124,6 +124,7 @@ file_close(struct log_stream *ls)
   if ((ls->udata & FF_CLOSE_FD) && ls->idata >= 0)
     close(ls->idata);
   xfree(ls->name);
+  xfree(ls->pdata);
 }
 
 /* handler for standard files */
@@ -160,7 +161,7 @@ log_new_file(const char *path)
 {
   struct log_stream *ls = log_new_stream();
   ls->idata = -1;
-  ls->pdata = (void *) path;
+  ls->pdata = xstrdup(path);
   if (strchr(path, '%'))
     ls->udata = FF_FORMAT_NAME;
   ls->udata |= FF_CLOSE_FD;