Skip to content

Commit bf8458a

Browse files
committed
Fix memory leaks on shape->values
1 parent 857a138 commit bf8458a

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

mapogr.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -2823,6 +2823,7 @@ msOGRFileNextShape(layerObj *layer, shapeObj *shape,
28232823
psInfo->last_record_index_read++;
28242824

28252825
if(layer->numitems > 0) {
2826+
if (shape->values) msFreeCharArray(shape->values, shape->numvalues);
28262827
shape->values = msOGRGetValues(layer, hFeature);
28272828
shape->numvalues = layer->numitems;
28282829
if(!shape->values) {

mapprimitive.c

+1
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ int msCopyShape(shapeObj *from, shapeObj *to)
131131
to->resultindex = from->resultindex;
132132

133133
if(from->values) {
134+
if (to->values) msFreeCharArray(to->values, to->numvalues);
134135
to->values = (char **)msSmallMalloc(sizeof(char *)*from->numvalues);
135136
for(i=0; i<from->numvalues; i++)
136137
to->values[i] = msStrdup(from->values[i]);

0 commit comments

Comments
 (0)