summaryrefslogtreecommitdiff
path: root/newgrf_config.c
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-12-20 20:43:52 +0000
committerDarkvater <darkvater@openttd.org>2006-12-20 20:43:52 +0000
commit1812bcfc8c20dfea2df38da7f7b042c2d62f551b (patch)
treef295888585422fc4f1016e2e401fdf3a3c1b8466 /newgrf_config.c
parent9011371e83a81deac255ea1b1e1f404b68b6c92d (diff)
downloadopenttd-1812bcfc8c20dfea2df38da7f7b042c2d62f551b.tar.xz
(svn r7517) -Codechange: Set pointers to NULL when freeing the newgrf config variables and add the proper const to CopyGRFConfigList
Diffstat (limited to 'newgrf_config.c')
-rw-r--r--newgrf_config.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/newgrf_config.c b/newgrf_config.c
index 924c3c628..b0f06d110 100644
--- a/newgrf_config.c
+++ b/newgrf_config.c
@@ -82,15 +82,16 @@ bool FillGRFDetails(GRFConfig *config, bool is_static)
}
-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 @@ void ClearGRFConfigList(GRFConfig *config)
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;