Skip to content

Commit

Permalink
Fix cppcheck reports:
Browse files Browse the repository at this point in the history
[src/providers/ogr/qgsogrprovider.cpp:1071]: (error) Memory leak: oldlocale
[src/providers/ogr/qgsogrprovider.cpp:1268]: (error) Memory leak: oldlocale
[src/core/spatialite/spatialite.c:50598]: (error) Memory leak: reader
[tests/src/core/testqgscolorscheme.cpp:155]: (error) Memory leak: dummyScheme2
[src/core/spatialite/spatialite.c:40138]: (error) Memory leak: ln
  • Loading branch information
serval2412 authored and jef-n committed Dec 30, 2014
1 parent 5a1df4a commit e6561ce
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/spatialite/spatialite.c
Expand Up @@ -40130,9 +40130,9 @@ fnct_aux_join_segments (gaiaLinestringPtr ln1, gaiaLinestringPtr ln2,
double m;
if (ln1->DimensionModel == GAIA_XY_Z)
ln = gaiaAllocLinestringXYZ (points);
if (ln1->DimensionModel == GAIA_XY_M)
else if (ln1->DimensionModel == GAIA_XY_M)
ln = gaiaAllocLinestringXYM (points);
if (ln1->DimensionModel == GAIA_XY_Z_M)
else if (ln1->DimensionModel == GAIA_XY_Z_M)
ln = gaiaAllocLinestringXYZM (points);
else
ln = gaiaAllocLinestring (points);
Expand Down Expand Up @@ -50595,6 +50595,7 @@ gaiaTextReaderAlloc (const char *path, char field_separator,
if (reader->toUtf8 == (void *) 0)
{
fclose (in);
free(reader);
return NULL;
}
reader->error = 0;
Expand Down
4 changes: 4 additions & 0 deletions src/providers/ogr/qgsogrprovider.cpp
Expand Up @@ -1067,6 +1067,8 @@ bool QgsOgrProvider::addFeature( QgsFeature& f )
OGR_F_Destroy( feature );

setlocale( LC_NUMERIC, oldlocale );
if (oldlocale)
free(oldlocale);

return returnValue;
}
Expand Down Expand Up @@ -1265,6 +1267,8 @@ bool QgsOgrProvider::changeAttributeValues( const QgsChangedAttributesMap & attr
}

setlocale( LC_NUMERIC, oldlocale );
if (oldlocale)
free(oldlocale);
}

if ( OGR_L_SyncToDisk( ogrLayer ) != OGRERR_NONE )
Expand Down
2 changes: 2 additions & 0 deletions tests/src/core/testqgscolorscheme.cpp
Expand Up @@ -152,6 +152,8 @@ void TestQgsColorScheme::clone()
QgsColorScheme* dummyScheme2 = dummyScheme->clone();
QgsNamedColorList colors2 = dummyScheme2->fetchColors();
QCOMPARE( colors, colors2 );
delete dummyScheme;
delete dummyScheme2;
}

QTEST_MAIN( TestQgsColorScheme )
Expand Down

0 comments on commit e6561ce

Please sign in to comment.