[GRASS-SVN] r36710 - grass/trunk/general/g.mapsets

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Apr 13 01:10:32 EDT 2009


Author: hcho
Date: 2009-04-13 01:10:32 -0400 (Mon, 13 Apr 2009)
New Revision: 36710

Modified:
   grass/trunk/general/g.mapsets/main.c
Log:
Free allocated memory

Modified: grass/trunk/general/g.mapsets/main.c
===================================================================
--- grass/trunk/general/g.mapsets/main.c	2009-04-13 05:03:54 UTC (rev 36709)
+++ grass/trunk/general/g.mapsets/main.c	2009-04-13 05:10:32 UTC (rev 36710)
@@ -101,6 +101,7 @@
     opt.dialog->description = _("Show mapset selection dialog");
 
     Path = NULL;
+    nmapsets = 0;
     nchoices = 0;
 
     if (G_parser(argc, argv))
@@ -195,6 +196,15 @@
 	if (opt.print->answer)
 	    display_mapset_path(opt.fs->answer);
 
+	if (Path)
+	    G_free(Path);
+
+	if (nmapsets) {
+	    for(nmapsets--; nmapsets >= 0; nmapsets--)
+		G_free(mapset_name[nmapsets]);
+	    G_free(mapset_name);
+	}
+
 	exit(EXIT_SUCCESS);
     }
 
@@ -244,6 +254,15 @@
     fclose(fp);
     G_free_tokens(tokens);
 
+    if (Path)
+	G_free(Path);
+
+    if (nmapsets) {
+	for(nmapsets--; nmapsets >= 0; nmapsets--)
+	    G_free(mapset_name[nmapsets]);
+	G_free(mapset_name);
+    }
+
     exit(EXIT_SUCCESS);
 }
 



More information about the grass-commit mailing list