Fix wrong make_scoped_guard usage
The common pitfall of using a lambda is wrong type of capture - by value instead of by reference. The simple example is: struct sequence_def *new_def = NULL; auto def_guard = make_scoped_guard([=] { free(new_def); }); // initialize new_def The problem is that the lambda captures pointer by value, that is NULL and will remain NULL in the lambda while new_def is successfully initialized in function scope. The patch fixes the problem above and a couple of similar mistakes. Fixes #5154
Loading
Please register or sign in to comment