From ca402e2f816b1b58c378defc084315498cd9918b Mon Sep 17 00:00:00 2001
From: Giuseppe Scrivano <gscrivan@redhat.com>
Date: Thu, 19 Jun 2014 19:57:25 +0200
Subject: [PATCH] windows: do not dinamically allocate info->lfilename.

---
 src/ChangeLog   | 6 ++++++
 src/mswindows.c | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index c5394c77..aabfaf57 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2014-06-19  Giuseppe Scrivano  <gscrivan@redhat.com>
+
+	* mswindows.c (fake_fork_child): Revert dinamic allocation of
+	info->lfilename.
+	Reported by: Gisle Vanem <gvanem@yahoo.no>.
+
 2014-06-16  Darshit Shah  <darnir@gmail.com>
 
 	* test.c: Include locale.h header for gettext.
diff --git a/src/mswindows.c b/src/mswindows.c
index 3bdf2178..0a0a8682 100644
--- a/src/mswindows.c
+++ b/src/mswindows.c
@@ -123,7 +123,7 @@ struct fake_fork_info
 {
   HANDLE event;
   bool logfile_changed;
-  char *lfilename;
+  char lfilename[MAX_PATH + 1];
 };
 
 /* Determines if we are the child and if so performs the child logic.
@@ -165,7 +165,7 @@ fake_fork_child (void)
       if (new_log_fp)
         {
           info->logfile_changed = true;
-          info->lfilename = strdup (opt.lfilename);
+          snprintf (info->filename, sizeof (info->lfilename), "%s", opt.lfilename);
           fclose (new_log_fp);
         }
     }