[GRASS-SVN] r29641 - grass/branches/releasebranch_6_3/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jan 9 12:44:32 EST 2008


Author: martinl
Date: 2008-01-09 12:44:32 -0500 (Wed, 09 Jan 2008)
New Revision: 29641

Modified:
   grass/branches/releasebranch_6_3/lib/gis/get_ellipse.c
Log:
Fixing memory leak in G_get_ellipsoid_parameters(), ticket #14 (merged from trunk)

Modified: grass/branches/releasebranch_6_3/lib/gis/get_ellipse.c
===================================================================
--- grass/branches/releasebranch_6_3/lib/gis/get_ellipse.c	2008-01-09 17:39:56 UTC (rev 29640)
+++ grass/branches/releasebranch_6_3/lib/gis/get_ellipse.c	2008-01-09 17:44:32 UTC (rev 29641)
@@ -67,6 +67,7 @@
     struct Key_Value *proj_keys;
     static char *PERMANENT = "PERMANENT";
 
+    proj_keys = NULL;
 
     G__file_name (ipath, "", PROJECTION_FILE, PERMANENT);
     if (access(ipath,0) !=0) 
@@ -95,6 +96,7 @@
 	  *a = 6370997.0 ;
         }
 	*e2 = 0.0 ;
+	G_free_key_value(proj_keys);
 	return 0;
       }
       else {
@@ -103,7 +105,10 @@
                               ,str,PROJECTION_FILE,PERMANENT);
 	  G_fatal_error (err);
         }
-        else return 1;
+        else {
+	    G_free_key_value(proj_keys);
+	    return 1;
+	}
       }
     }
     else {
@@ -120,6 +125,7 @@
                             ,str,PROJECTION_FILE,PERMANENT);
 	  G_fatal_error (err);
         }
+	G_free_key_value(proj_keys);
         return 1;
       }
       else { 
@@ -127,6 +133,7 @@
         if ((str==NULL)||(strcmp(str,"ll")==0)) { 
   	  *a = 6378137.0 ;
 	  *e2 = .006694385 ;
+	  G_free_key_value(proj_keys);
 	  return 0;
         }
         else {
@@ -136,6 +143,9 @@
         }
       }
     }
+
+    G_free_key_value(proj_keys);
+
     return 1;
     /* whats that? al 05/2000 */
     return 0;



More information about the grass-commit mailing list