changeset 9703:902a35129568 draft

(svn r13814) -Fix (r13810): MSVC (as usual) does stupid things. This time it is copying around a struct it created itself, causing bad things to happen if you don't explicitly set all variables to something remotely sane in the constructor.
author rubidium <rubidium@openttd.org>
date Thu, 24 Jul 2008 08:46:34 +0000
parents ab8ad03c5ff9
children e1476334067a
files src/tar_type.h
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/tar_type.h
+++ b/src/tar_type.h
@@ -12,6 +12,10 @@
 struct TarListEntry {
 	const char *filename;
 
+	/* MSVC goes copying around this struct after initialisation, so it tries
+	 * to free filename, which isn't set at that moment... but because it
+	 * initializes the variable with garbage, it's going to segfault. */
+	TarListEntry() : filename(NULL) {}
 	~TarListEntry() { free((void*)this->filename); }
 };