Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix some memory leaks
  • Loading branch information
nyalldawson committed Apr 5, 2019
1 parent 3c4b2a7 commit d4420c5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/app/qgsvectorlayerlegendwidget.cpp
Expand Up @@ -86,7 +86,7 @@ void QgsVectorLayerLegendWidget::setLayer( QgsVectorLayer *layer )

void QgsVectorLayerLegendWidget::populateLegendTreeView( const QHash<QString, QString> &content )
{
QStandardItemModel *model = new QStandardItemModel;
QStandardItemModel *model = new QStandardItemModel( this );
model->setColumnCount( 2 );
model->setHorizontalHeaderLabels( QStringList() << tr( "Symbol" ) << tr( "Text" ) );

Expand Down
6 changes: 3 additions & 3 deletions src/core/qgsziputils.cpp
Expand Up @@ -78,8 +78,8 @@ bool QgsZipUtils::unzip( const QString &zipFilename, const QString &dir, QString
size_t len = stat.size;

struct zip_file *file = zip_fopen_index( z, i, 0 );
char *buf = new char[len];
if ( zip_fread( file, buf, len ) != -1 )
std::unique_ptr< char[] > buf( new char[len] );
if ( zip_fread( file, buf.get(), len ) != -1 )
{
QString fileName( stat.name );
QFileInfo newFile( QDir( dir ), fileName );
Expand All @@ -98,7 +98,7 @@ bool QgsZipUtils::unzip( const QString &zipFilename, const QString &dir, QString
}
else
{
outFile.write( buf, len );
outFile.write( buf.get(), len );
}
zip_fclose( file );
files.append( newFile.absoluteFilePath() );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsmetadatawidget.cpp
Expand Up @@ -46,7 +46,7 @@ QgsMetadataWidget::QgsMetadataWidget( QWidget *parent, QgsMapLayer *layer )
mDefaultCategories << tr( "Farming" ) << tr( "Climatology Meteorology Atmosphere" ) << tr( "Location" ) << tr( "Intelligence Military" ) << tr( "Transportation" ) << tr( "Structure" ) << tr( "Boundaries" );
mDefaultCategories << tr( "Inland Waters" ) << tr( "Planning Cadastre" ) << tr( "Geoscientific Information" ) << tr( "Elevation" ) << tr( "Health" ) << tr( "Biota" ) << tr( "Oceans" ) << tr( "Environment" );
mDefaultCategories << tr( "Utilities Communication" ) << tr( "Economy" ) << tr( "Society" ) << tr( "Imagery Base Maps Earth Cover" );
mDefaultCategoriesModel = new QStringListModel( mDefaultCategories );
mDefaultCategoriesModel = new QStringListModel( mDefaultCategories, this );
mDefaultCategoriesModel->sort( 0 ); // Sorting using translations
listDefaultCategories->setModel( mDefaultCategoriesModel );

Expand Down

0 comments on commit d4420c5

Please sign in to comment.