зеркало из https://github.com/github/codeql.git
Merge pull request #13874 from jketema/use-after-free
C++: Improve use-after-free example code
This commit is contained in:
Коммит
48048d6f38
|
@ -1,9 +1,10 @@
|
|||
int f() {
|
||||
void f() {
|
||||
char* buf = new char[SIZE];
|
||||
....
|
||||
...
|
||||
if (error) {
|
||||
free(buf); //error handling has freed the buffer
|
||||
delete buf; //error handling has freed the buffer
|
||||
}
|
||||
...
|
||||
log_contents(buf); //but it is still used here for logging
|
||||
...
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче