changeset 13889:574d325b9767 draft

(svn r18418) -Fix [FS#3298]: under some circumstances a pointer could be left untouched and then freed. Make sure this doesn't happen by ensuring it starts out as NULL instead of 'garbage'.
author rubidium <rubidium@openttd.org>
date Sun, 06 Dec 2009 20:22:21 +0000
parents 03a805259ae9
children 32e58ed16e0b
files src/ai/ai_info.cpp src/ai/ai_info.hpp src/script/script_info.hpp
diffstat 3 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/ai/ai_info.cpp
+++ b/src/ai/ai_info.cpp
@@ -131,6 +131,13 @@
 	return this->engine->CallMethod(*this->SQ_instance, "GetSettings", NULL, -1);
 }
 
+AIInfo::AIInfo() :
+	min_loadable_version(0),
+	use_as_random(false),
+	api_version(NULL)
+{
+}
+
 AIInfo::~AIInfo()
 {
 	/* Free all allocated strings */
--- a/src/ai/ai_info.hpp
+++ b/src/ai/ai_info.hpp
@@ -58,6 +58,7 @@
 public:
 	static const char *GetClassName() { return "AIInfo"; }
 
+	AIInfo();
 	~AIInfo();
 
 	/**
--- a/src/script/script_info.hpp
+++ b/src/script/script_info.hpp
@@ -25,6 +25,7 @@
 		description(NULL),
 		date(NULL),
 		instance_name(NULL),
+		version(0),
 		url(NULL)
 	{}
 	~ScriptFileInfo();