src/driver.cpp
changeset 9489 1a097da71d88
parent 9470 08424e2e79e4
child 9533 e8b86b70c5f6
--- a/src/driver.cpp	Tue Jun 10 21:59:22 2008 +0000
+++ b/src/driver.cpp	Wed Jun 11 12:46:28 2008 +0000
@@ -183,3 +183,18 @@
 
 	return p;
 }
+
+/** Frees memory used for this->name
+ */
+DriverFactoryBase::~DriverFactoryBase() {
+	if (this->name == NULL) return;
+
+	/* Prefix the name with driver type to make it unique */
+	char buf[32];
+	strecpy(buf, GetDriverTypeName(type), lastof(buf));
+	strecpy(buf + 5, this->name, lastof(buf));
+
+	GetDrivers().erase(buf);
+	if (GetDrivers().empty()) delete &GetDrivers();
+	free(this->name);
+}