Skip to content
Permalink
Browse files

Fix memory corruption (free address of reference) in server

  • Loading branch information
nyalldawson committed Jan 27, 2017
1 parent bfdd9dc commit 8d9357a1a8291032e3de87a7775bc0f03c836534
Showing with 7 additions and 8 deletions.
  1. +6 −7 src/server/qgswmsconfigparser.cpp
  2. +1 −1 src/server/qgswmsconfigparser.h
@@ -342,7 +342,7 @@ QStringList QgsWmsConfigParser::addHighlightLayers( const QMap<QString, QString>
labelString = labelSplit.at( i );
}

QScopedPointer<QgsVectorLayer> layer( createHighlightLayer( i, crsString, &geom, labelString, labelSizeSplit, labelColorSplit, labelWeightSplit, labelFontSplit,
QScopedPointer<QgsVectorLayer> layer( createHighlightLayer( i, crsString, geom, labelString, labelSizeSplit, labelColorSplit, labelWeightSplit, labelFontSplit,
labelBufferSizeSplit, labelBufferColorSplit ) );
if ( !layer.data() )
{
@@ -357,7 +357,7 @@ QStringList QgsWmsConfigParser::addHighlightLayers( const QMap<QString, QString>
return highlightLayers;
}

QgsVectorLayer* QgsWmsConfigParser::createHighlightLayer( int i, const QString& crsString, QgsGeometry* geom, const QString& labelString, const QStringList& labelSizeSplit, const QStringList& labelColorSplit,
QgsVectorLayer* QgsWmsConfigParser::createHighlightLayer( int i, const QString& crsString, const QgsGeometry& geom, const QString& labelString, const QStringList& labelSizeSplit, const QStringList& labelColorSplit,
const QStringList& labelWeightSplit, const QStringList& labelFontSplit, const QStringList& labelBufferSizeSplit,
const QStringList& labelBufferColorSplit )
{
@@ -366,8 +366,8 @@ QgsVectorLayer* QgsWmsConfigParser::createHighlightLayer( int i, const QString&
return 0;
}

QgsWkbTypes::GeometryType geomType = geom->type();
QString typeName = QString( QgsWkbTypes::displayString( geom->wkbType() ) ).replace( QLatin1String( "WKB" ), QLatin1String( "" ) );
QgsWkbTypes::GeometryType geomType = geom.type();
QString typeName = QString( QgsWkbTypes::displayString( geom.wkbType() ) ).replace( QLatin1String( "WKB" ), QLatin1String( "" ) );
QString url = typeName + "?crs=" + crsString;
if ( !labelString.isEmpty() )
{
@@ -391,7 +391,7 @@ QgsVectorLayer* QgsWmsConfigParser::createHighlightLayer( int i, const QString&
fet.setAttribute( 0, labelString );
if ( geomType == QgsWkbTypes::PolygonGeometry )
{
QgsGeometry point = geom->pointOnSurface();
QgsGeometry point = geom.pointOnSurface();
if ( point )
{
QgsPoint pt = point.asPoint();
@@ -472,8 +472,7 @@ QgsVectorLayer* QgsWmsConfigParser::createHighlightLayer( int i, const QString&
layer->setCustomProperty( QStringLiteral( "labeling/placement" ), placement );
}

fet.setGeometry( *geom );
delete geom;
fet.setGeometry( geom );
layer->dataProvider()->addFeatures( QgsFeatureList() << fet );
return layer;
}
@@ -158,7 +158,7 @@ class SERVER_EXPORT QgsWmsConfigParser
QStringList& labelFont, QStringList& labelSize, QStringList& labelWeight, QStringList& labelColor,
QStringList& labelBufferColor, QStringList &labelBufferSize );

static QgsVectorLayer* createHighlightLayer( int i, const QString& crsString, QgsGeometry* geom, const QString& labelString, const QStringList& labelSizeSplit, const QStringList& labelColorSplit,
static QgsVectorLayer* createHighlightLayer( int i, const QString& crsString, const QgsGeometry& geom, const QString& labelString, const QStringList& labelSizeSplit, const QStringList& labelColorSplit,
const QStringList& labelWeightSplit, const QStringList& labelFontSplit, const QStringList& labelBufferSizeSplit,
const QStringList& labelBufferColorSplit );

0 comments on commit 8d9357a

Please sign in to comment.
You can’t perform that action at this time.