Is it a bug from DICOM example?

in the example DICOM, if we run the example without the .g4dcm, we will meet a error, the error will not exit when we
do not use the
G4int DicomHandler::ReadData(FILE *dicom,char * filename2)
{
// delete nameProcessed;
}

i do not know the function of the code( delete nameProcessed;)
G4String nameProcessed = filename2 + G4String(“.g4dcmb”);
the nameProcessed is justly a variable string.

@czgchd
.g4dcm is text image format file.
and .g4dcmb is binary format file.

Can you post error.

thank for your reply, i will describe the problem.
firstly, i remove the file(1.g4dcm 2.g4dcm 3.g4dcm,1.g4 2.g4 3.g4) in the DICOM folder file because we will not have the similar file if we use ourself CT file.
and then , i use the cmake and make command to build the code.After that , i begin to perform the command ./DICOM, the following the error will happen.

/********************************/
All the necessary images were not found in processed form , starting with .dcm images
fNFiles 3

Opening 1.dcm and reading :

ReadFile 1
[0x00020010] Endian → 1.2.840.10008.1.2
[0x00080008] Image Types → ORIGINAL\PRIMARY\AXIAL\HELIX
[0x00080070] Manufacturer → Philips
[0x00080080] Institution Name → OSP S.CROCE CUNEO
[0x00080081] Institution Address → CUNEO
[0x00081040] Institution Department Name → RADIOLOGIA
[0x00081090] Manufacturer’s Model Name → Brilliance 64
[0x00180050] Slice Thickness (mm) → 5.000000
[0x00200032] Image Position (Phantom,mm) → -196-39-82.5
[0x00200037] Image Orientation (Phantom) → 1\0\0\0\1\0
[0x00201041] Slice Location → 82.500000
[0x00280004] Photometric Interpretation → MONOCHROME2
[0x00280010] Rows → 512
[0x00280011] Columns → 512
[0x00280100] Bits allocated → 16
[0x00280101] Bits stored → 12
[0x00280102] High bits → 11
[0x00280103] Pixel Representation → 0
[0x00281052] Rescale Intercept → -1024
[0x00281053] Rescale Slope → 1
512 512
0.765625 0.765625
5.000000
82.500000
8
free(): invalid size
Aborted (core dumped)
/****************************************/
if i do not use the following code line :
delete nameProcessed (from the DicomHandler.cc file)

the error will not happen.

i do not understand the reason, but i now begin to use the DCMTK to build code. Although i use the (delete nameProcessed) code , the error will not happen.

thanks!