mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2025-12-17 20:54:41 +03:00
Added missing capture clause in lambda expression and missing variable name from declaration of file object...
This commit is contained in:
@@ -6701,7 +6701,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
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6711,7 +6711,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);
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user