[GRASS-SVN] r34546 - grass/branches/develbranch_6/lib/proj

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Nov 27 15:52:35 EST 2008


Author: neteler
Date: 2008-11-27 15:52:35 -0500 (Thu, 27 Nov 2008)
New Revision: 34546

Modified:
   grass/branches/develbranch_6/lib/proj/ellipse.c
Log:
glynn: Fix memory leak; cleanup (merge from trunk, r34411)

Modified: grass/branches/develbranch_6/lib/proj/ellipse.c
===================================================================
--- grass/branches/develbranch_6/lib/proj/ellipse.c	2008-11-27 20:28:33 UTC (rev 34545)
+++ grass/branches/develbranch_6/lib/proj/ellipse.c	2008-11-27 20:52:35 UTC (rev 34546)
@@ -197,7 +197,6 @@
 {
     FILE *fd;
     char *file;
-    char *errbuf;
     char buf[4096];
     char name[100], descr[1024], buf1[1024], buf2[1024];
     char badlines[1024];
@@ -213,10 +212,8 @@
 
     if (fd == NULL) {
 	perror(file);
-	G_asprintf(&errbuf, _("Unable to open ellipsoid table file <%s>"),
-		   file);
-	fatal ? G_fatal_error(errbuf) : G_warning(errbuf);
-	G_free(errbuf);
+	(fatal ? G_fatal_error : G_warning)(
+	    _("Unable to open ellipsoid table file <%s>"), file);
 	return 0;
     }
 
@@ -264,15 +261,16 @@
 
     fclose(fd);
 
-    if (!err)
+    if (!err) {
+	G_free(file);
 	return outputlist;
+    }
 
-    G_asprintf(&errbuf,
-	       (err == 1 ? "Line%s of ellipsoid table file <%s> is invalid"
-		: "Lines%s of ellipsoid table file <%s> are invalid"),
-	       badlines, file);
-    fatal ? G_fatal_error(errbuf) : G_warning(errbuf);
-    G_free(errbuf);
+    (fatal ? G_fatal_error : G_warning)(
+	err == 1
+	? _("Line%s of ellipsoid table file <%s> is invalid")
+	: _("Lines%s of ellipsoid table file <%s> are invalid"),
+	badlines, file);
     G_free(file);
     return outputlist;
 }



More information about the grass-commit mailing list