mirror of
https://github.com/github/codeql.git
synced 2025-12-24 12:46:34 +01:00
14 lines
261 B
C++
14 lines
261 B
C++
int* f() {
|
|
int *buff = NULL;
|
|
try {
|
|
buff = malloc(SIZE*sizeof(int));
|
|
do_stuff(buff);
|
|
return buff;
|
|
} catch (int do_stuff_exception) {
|
|
if (buff != NULL) {
|
|
free(buff);
|
|
}
|
|
return NULL; //returns NULL on error, having freed any allocated memory
|
|
}
|
|
}
|