Skip to content

Commit

Permalink
Merge pull request #11072 from AbelPau/MiraMonVector-fix-372358476
Browse files Browse the repository at this point in the history
MiraMonVector: fix issue 372358476
  • Loading branch information
rouault authored Oct 22, 2024
2 parents 1222614 + 14e0449 commit c12ec9f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ogr/ogrsf_frmts/miramon/mm_wrlayr.c
Original file line number Diff line number Diff line change
Expand Up @@ -6333,8 +6333,9 @@ int MMCreateMMDB(struct MiraMonVectLayerInfo *hMiraMonLayer,

// Before allocating new memory, there might be some previously allocated but unused memory.
// Let's free that memory first.
if (hMiraMonLayer->MMArc.MMNode.MMAdmDB.pMMBDXP)
MM_ReleaseDBFHeader(&hMiraMonLayer->MMArc.MMNode.MMAdmDB.pMMBDXP);
if (hMiraMonLayer->MMPolygon.MMArc.MMAdmDB.pMMBDXP)
MM_ReleaseDBFHeader(
&hMiraMonLayer->MMPolygon.MMArc.MMAdmDB.pMMBDXP);

pBD_XP_Aux = hMiraMonLayer->MMPolygon.MMArc.MMAdmDB.pMMBDXP =
MM_CreateDBFHeader(5, hMiraMonLayer->nCharSet);
Expand All @@ -6349,6 +6350,12 @@ int MMCreateMMDB(struct MiraMonVectLayerInfo *hMiraMonLayer,
: 9))
return 1;

// Before allocating new memory, there might be some previously allocated but unused memory.
// Let's free that memory first.
if (hMiraMonLayer->MMPolygon.MMArc.MMNode.MMAdmDB.pMMBDXP)
MM_ReleaseDBFHeader(
&hMiraMonLayer->MMPolygon.MMArc.MMNode.MMAdmDB.pMMBDXP);

pBD_XP_Aux = hMiraMonLayer->MMPolygon.MMArc.MMNode.MMAdmDB.pMMBDXP =
MM_CreateDBFHeader(3, hMiraMonLayer->nCharSet);

Expand Down

0 comments on commit c12ec9f

Please sign in to comment.