@@ -527,6 +527,9 @@ OGRMiraMonLayer::~OGRMiraMonLayer()
527
527
if (MMCloseLayer (&hMiraMonLayerPOL))
528
528
{
529
529
CPLDebugOnly (" MiraMon" , " Error closing polygons layer" );
530
+
531
+ // In case of closing we need to destroy memory
532
+ MMDestroyLayer (&hMiraMonLayerPOL);
530
533
}
531
534
if (hMiraMonLayerPOL.TopHeader .nElemCount )
532
535
{
@@ -548,6 +551,9 @@ OGRMiraMonLayer::~OGRMiraMonLayer()
548
551
if (MMCloseLayer (&hMiraMonLayerARC))
549
552
{
550
553
CPLDebugOnly (" MiraMon" , " Error closing arcs layer" );
554
+
555
+ // In case of closing we need to destroy memory
556
+ MMDestroyLayer (&hMiraMonLayerARC);
551
557
}
552
558
if (hMiraMonLayerARC.TopHeader .nElemCount )
553
559
{
@@ -570,6 +576,9 @@ OGRMiraMonLayer::~OGRMiraMonLayer()
570
576
if (MMCloseLayer (&hMiraMonLayerPNT))
571
577
{
572
578
CPLDebugOnly (" MiraMon" , " Error closing points layer" );
579
+
580
+ // In case of closing we need to destroy memory
581
+ MMDestroyLayer (&hMiraMonLayerPNT);
573
582
}
574
583
if (hMiraMonLayerPNT.TopHeader .nElemCount )
575
584
{
@@ -593,7 +602,11 @@ OGRMiraMonLayer::~OGRMiraMonLayer()
593
602
{
594
603
CPLDebugOnly (" MiraMon" , " Closing MiraMon DBF table ..." );
595
604
}
596
- MMCloseLayer (&hMiraMonLayerReadOrNonGeom);
605
+ if (MMCloseLayer (&hMiraMonLayerReadOrNonGeom))
606
+ {
607
+ // In case of closing we need to destroy memory
608
+ MMDestroyLayer (&hMiraMonLayerReadOrNonGeom);
609
+ }
597
610
if (hMiraMonLayerReadOrNonGeom.ReadOrWrite == MM_WRITING_MODE)
598
611
{
599
612
CPLDebugOnly (" MiraMon" , " MiraMon DBF table closed" );
@@ -610,7 +623,11 @@ OGRMiraMonLayer::~OGRMiraMonLayer()
610
623
{
611
624
CPLDebugOnly (" MiraMon" , " Closing MiraMon layer ..." );
612
625
}
613
- MMCloseLayer (&hMiraMonLayerReadOrNonGeom);
626
+ if (MMCloseLayer (&hMiraMonLayerReadOrNonGeom))
627
+ {
628
+ // In case of closing we need to destroy memory
629
+ MMDestroyLayer (&hMiraMonLayerReadOrNonGeom);
630
+ }
614
631
if (hMiraMonLayerReadOrNonGeom.ReadOrWrite == MM_WRITING_MODE)
615
632
{
616
633
CPLDebugOnly (" MiraMon" , " MiraMon layer closed" );
0 commit comments