summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-07-24 08:46:34 +0000
committerrubidium <rubidium@openttd.org>2008-07-24 08:46:34 +0000
commit9bee9948986c4c4905c53b6214311e2ddb6d6e8d (patch)
tree5c1326188e9088a9d688adc6ae835cb044e16fbc /src
parent81c50c6c325adcf771f000190d53ab911d83d2f6 (diff)
downloadopenttd-9bee9948986c4c4905c53b6214311e2ddb6d6e8d.tar.xz
(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.
Diffstat (limited to 'src')
-rw-r--r--src/tar_type.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/tar_type.h b/src/tar_type.h
index 04f7250e6..233b0eada 100644
--- 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); }
};