Skip to content

Commit

Permalink
Fixed #13211: gnu.cfg: Improved configuration of backtrace() (danmar#…
Browse files Browse the repository at this point in the history
  • Loading branch information
orbitcowboy authored Oct 11, 2024
1 parent d23c88d commit 6650bce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions cfg/gnu.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,7 @@
<function name="backtrace">
<returnValue type="int"/>
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1" direction="out">
<not-null/>
<minsize type="argvalue" arg="2"/>
Expand Down
10 changes: 10 additions & 0 deletions test/cfg/gnu.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <sys/mman.h>
#include <sys/sem.h>
#include <wchar.h>
#include <execinfo.h>
#if !defined(__CYGWIN__) && !defined(__APPLE__)
#include <sys/epoll.h>
#endif
Expand All @@ -47,6 +48,15 @@ void unreachableCode_error(void) // #11197
}
#endif


int deallocuse_backtrace(int size) {
void **buffer = (void **)malloc(sizeof(void *) * size);
free(buffer);
// cppcheck-suppress deallocuse
int numEntries = backtrace(buffer, size);
return numEntries;
}

void leakReturnValNotUsed_get_current_dir_name(void)
{
// cppcheck-suppress leakReturnValNotUsed
Expand Down

0 comments on commit 6650bce

Please sign in to comment.