Skip to content

Commit e848cd7

Browse files
authored
Merge pull request #16 from bensarthou/master
[BUG] Adding case in free() function to avoid pointer undefined
2 parents 6ec0493 + 1a4745b commit e848cd7

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

src/libsparse3d/MR3D_Obj.cc

+20-7
Original file line numberDiff line numberDiff line change
@@ -849,14 +849,27 @@ void MR_3D::free ()
849849
Border = DEFAULT_BORDER_3D;
850850
switch (Set_Transform)
851851
{
852-
case TRANS3_MALLAT:
853-
Data.free();
852+
case TRANS3_MALLAT:
853+
Data.free();
854854
break;
855-
case TRANS3_PAVE:
856-
AT3D_WT.free(TabBand, Nbr_Plan);
857-
break;
858-
default: cerr << "Error: bad transform ... " << endl;
859-
exit(-1);
855+
case TRANS3_PAVE:
856+
AT3D_WT.free(TabBand, Nbr_Plan);
857+
break;
858+
case S3_UNDEFINED:
859+
// We set those attrributes to NULL because these should be instantiated
860+
// in the init().
861+
TabPosX = NULL;
862+
TabSizeNx = NULL;
863+
TabPosY = NULL;
864+
TabSizeNy = NULL;
865+
TabPosZ = NULL;
866+
TabSizeNz = NULL;
867+
FilterBank = NULL;
868+
break;
869+
870+
default: cerr << "Error: bad transform ... " << endl;
871+
exit(-1);
872+
860873
}
861874
Nbr_Plan = 0;
862875
Nbr_Band = 0;

0 commit comments

Comments
 (0)