Gitlab updates will be applied at 1:30pm, (17:30 UTC), today. No downtime expected.

Commit 69601ed3 authored by Ben Boeckel's avatar Ben Boeckel

vtkNIFTIImageReader: plug memory leaks

Change-Id: I96903ef5343f319a4e33e84f0afaaf709cfb8753
parent 25baa62d
......@@ -449,14 +449,17 @@ int vtkNIFTIImageReader::RequestInformation(
// this checks for .hdr and .hdr.gz, case insensitive
if (vtkNIFTIImageReader::CheckExtension(filename, ".hdr"))
{
headers++;
hdrname = new char[strlen(filename) + 1];
strcpy(hdrname, filename);
if (++headers < 2)
{
hdrname = new char[strlen(filename) + 1];
strcpy(hdrname, filename);
}
}
}
if (n != 2 || headers != 1)
{
vtkErrorMacro("There must be two files and one must be a .hdr file.");
delete [] hdrname;
return 0;
}
}
......@@ -1104,6 +1107,7 @@ int vtkNIFTIImageReader::RequestData(
if (n != 2 || headers != 1)
{
vtkErrorMacro("There must be two files and one must be a .hdr file.");
delete [] imgname;
return 0;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment