Commit 8e692744 authored by Bill Hoffman's avatar Bill Hoffman
Browse files

ENH: fix descriptor leak

parent 2a45d285
......@@ -117,7 +117,10 @@ int vtkDirectory::Open(const char* name)
int vtkDirectory::Open(const char* name)
{
DIR* dir = opendir(name);
if (!dir) return 0;
if (!dir)
{
return 0;
}
this->NumberOfFiles = 0;
dirent* d =0;
......@@ -129,6 +132,10 @@ int vtkDirectory::Open(const char* name)
closedir(dir);
dir = opendir(name);
if (!dir)
{
return 0;
}
int i = 0;
for (d = readdir(dir); d; d = readdir(dir))
{
......@@ -136,6 +143,7 @@ int vtkDirectory::Open(const char* name)
i++;
}
this->Path = strcpy(new char[strlen(name)+1], name);
closedir(dir);
return 1;
}
......
Supports Markdown
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