newgrf_config.c
changeset 5346 3687c73bc65b
parent 5339 96ac3f4933bb
child 5347 9b1bc705f2ae
--- a/newgrf_config.c	Wed Dec 20 19:16:44 2006 +0000
+++ b/newgrf_config.c	Wed Dec 20 20:43:52 2006 +0000
@@ -82,15 +82,16 @@
 }
 
 
-void ClearGRFConfig(GRFConfig *config)
+void ClearGRFConfig(GRFConfig **config)
 {
 	/* GCF_COPY as in NOT strdupped/alloced the filename, name and info */
-	if (!HASBIT(config->flags, GCF_COPY)) {
-		free(config->filename);
-		free(config->name);
-		free(config->info);
+	if (!HASBIT((*config)->flags, GCF_COPY)) {
+		free((*config)->filename);
+		free((*config)->name);
+		free((*config)->info);
 	}
-	free(config);
+	free(*config);
+	*config = NULL;
 }
 
 
@@ -100,13 +101,13 @@
 	GRFConfig *c, *next;
 	for (c = config; c != NULL; c = next) {
 		next = c->next;
-		ClearGRFConfig(c);
+		ClearGRFConfig(&c);
 	}
 }
 
 
 /* Copy a GRF Config list */
-static GRFConfig **CopyGRFConfigList(GRFConfig **dst, GRFConfig *src)
+GRFConfig **CopyGRFConfigList(GRFConfig **dst, const GRFConfig *src)
 {
 	GRFConfig *c;