From ef932e4d05a45b9a3034423e30519d15e664f2bc Mon Sep 17 00:00:00 2001 From: jrt Date: Fri, 5 Sep 2003 11:45:54 +0000 Subject: [PATCH] Correct some memory leaks --- src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.cxx | 4 +++- src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx | 7 +++---- src/SMESH/SMESH_Hexa_3D.cxx | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.cxx b/src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.cxx index adcbd218d..0c988c3d8 100644 --- a/src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.cxx +++ b/src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.cxx @@ -196,6 +196,7 @@ void DriverDAT_W_SMESHDS_Mesh::Add() SMDS_Iterator * itNodes=elem->nodesIterator(); while(itNodes->more()) fprintf(myFileId, "%d ", itNodes->next()->GetID()); + delete itNodes; fprintf(myFileId, "\n"); } @@ -218,7 +219,8 @@ void DriverDAT_W_SMESHDS_Mesh::Add() SMDS_Iterator * itNodes=elem->nodesIterator(); while(itNodes->more()) fprintf(myFileId, "%d ", itNodes->next()->GetID()); - + delete itNodes; + fprintf(myFileId, "\n"); } delete itVolumes; diff --git a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx index 5665790ad..1c602e378 100644 --- a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx +++ b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx @@ -573,12 +573,12 @@ void DriverMED_W_SMESHDS_Mesh::Add() /* allocation memoire */ connectivite = (med_int *) malloc(sizeof(med_int) * taille * nmailles[i]); - nomele = + /* nomele = (char *)malloc(sizeof(char) * MED_TAILLE_PNOM * - nmailles[i] + 1); + nmailles[i] + 1);*/ + nomele = ""; numele = (med_int *) malloc(sizeof(med_int) * nmailles[i]); nufael = (med_int *) malloc(sizeof(med_int) * nmailles[i]); - nomele = ""; nbNodes = typmai[i] % 100; for (j = 0; j < nmailles[i]; j++) @@ -637,7 +637,6 @@ void DriverMED_W_SMESHDS_Mesh::Add() /* liberation memoire */ free(connectivite); free(numele); - free(nomele); free(nufael); MESSAGE(" End " << typmai[i]); } diff --git a/src/SMESH/SMESH_Hexa_3D.cxx b/src/SMESH/SMESH_Hexa_3D.cxx index 69f036fc1..ef661bc83 100644 --- a/src/SMESH/SMESH_Hexa_3D.cxx +++ b/src/SMESH/SMESH_Hexa_3D.cxx @@ -439,6 +439,7 @@ bool SMESH_Hexa_3D::Compute(SMESH_Mesh & aMesh, int ij1 = j1 * nbdown + i1; quad->uv_grid[ij1].node = node; } + delete itf; for (int i1 = 0; i1 < nbdown; i1++) for (int j1 = 0; j1 < nbright; j1++) -- 2.39.2