[GRASS-SVN] r34411 - grass/trunk/lib/proj

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Nov 20 16:05:50 EST 2008


Author: glynn
Date: 2008-11-20 16:05:50 -0500 (Thu, 20 Nov 2008)
New Revision: 34411

Modified:
   grass/trunk/lib/proj/ellipse.c
Log:
Fix memory leak
Cleanup


Modified: grass/trunk/lib/proj/ellipse.c
===================================================================
--- grass/trunk/lib/proj/ellipse.c	2008-11-20 20:04:59 UTC (rev 34410)
+++ grass/trunk/lib/proj/ellipse.c	2008-11-20 21:05:50 UTC (rev 34411)
@@ -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