changeset 2289:7f755ad3d860

Add locFreeFileInfo() to liblocfile and use it to plug a non-essential memory leak in mkcitymap.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 26 Apr 2020 23:57:36 +0300
parents 20d640df353f
children 3b1432046446
files liblocfile.c liblocfile.h mkcitymap.c
diffstat 3 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/liblocfile.c	Sun Apr 26 08:28:41 2020 +0300
+++ b/liblocfile.c	Sun Apr 26 23:57:36 2020 +0300
@@ -823,3 +823,10 @@
     file->continent = th_strdup(continent);
     file->xoffs = file->yoffs = 0;
 }
+
+
+void locFreeFileInfo(LocFileInfo *file)
+{
+    th_free(file->filename);
+    th_free(file->continent);
+}
--- a/liblocfile.h	Sun Apr 26 08:28:41 2020 +0300
+++ b/liblocfile.h	Sun Apr 26 23:57:36 2020 +0300
@@ -157,5 +157,7 @@
 void   locCopyLocations(MapLocations *dst, const MapLocations *src);
 
 void   locSetFileInfo(LocFileInfo *file, const char *filename, const char *continent);
+void   locFreeFileInfo(LocFileInfo *file);
+
 
 #endif
--- a/mkcitymap.c	Sun Apr 26 08:28:41 2020 +0300
+++ b/mkcitymap.c	Sun Apr 26 23:57:36 2020 +0300
@@ -439,6 +439,7 @@
 
     mapBlockFree(map);
     locFreeMapLocations(&locations);
+    locFreeFileInfo(&info);
 
     return 0;
 }