[mapserver-commits] r7893 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Mon Sep 1 22:57:49 EDT 2008
Author: sdlime
Date: 2008-09-01 22:57:48 -0400 (Mon, 01 Sep 2008)
New Revision: 7893
Modified:
trunk/mapserver/mapprimitive.c
Log:
Added check after malloc/realloc in msAddLineDirectly().
Modified: trunk/mapserver/mapprimitive.c
===================================================================
--- trunk/mapserver/mapprimitive.c 2008-08-30 07:14:24 UTC (rev 7892)
+++ trunk/mapserver/mapprimitive.c 2008-09-02 02:57:48 UTC (rev 7893)
@@ -1,5 +1,5 @@
/******************************************************************************
- * $Id:$
+ * $Id$
*
* Project: MapServer
* Purpose: Implementations for rectObj, pointObj, lineObj, shapeObj, etc.
@@ -322,7 +322,12 @@
p->line = (lineObj *) malloc(sizeof(lineObj));
else
p->line = (lineObj *) realloc(p->line, (p->numlines+1)*sizeof(lineObj));
-
+
+ if(!p->line) {
+ msSetError(MS_MEMERR, NULL, "msAddLineDirectly()");
+ return(MS_FAILURE);
+ }
+
/* Copy the new line onto the end of the extended line array */
c= p->numlines;
p->line[c].numpoints = new_line->numpoints;
@@ -1247,7 +1252,7 @@
segment_index = line_index = 0;
total_length = max_line_length = 0.0;
- /* determine longest line */
+ /* determine longest line segment */
segment_lengths = (double **) malloc(sizeof(double *) * p->numlines);
for(i=0; i<p->numlines; i++) {
More information about the mapserver-commits
mailing list