Merge pull request #386 from RicoAntonioFelix/master

Correction of minor errors...
This commit is contained in:
Gabriel Dos Reis
2015-11-18 16:05:42 -08:00

View File

@@ -6750,7 +6750,7 @@ If you don't, an exception or a return may lead to a leak.
{ {
FILE* f = fopen(name, "r"); // open the file FILE* f = fopen(name, "r"); // open the file
vector<char> buf(1024); vector<char> buf(1024);
auto _ = finally([] { fclose(f); }) // remember to close the file auto _ = finally([f] { fclose(f); }) // remember to close the file
// ... // ...
} }
@@ -6760,7 +6760,7 @@ The allocation of `buf` may fail and leak the file handle.
void f(const string& name) void f(const string& name)
{ {
ifstream {name, "r"}; // open the file ifstream f{name, "r"}; // open the file
vector<char> buf(1024); vector<char> buf(1024);
// ... // ...
} }