Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cfg/posix.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5259,7 +5259,7 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
<not-uninit/>
<valid>0:255</valid>
</arg>
<arg nr="4" direction="in">
<arg nr="4" direction="inout">
<not-null/>
<not-uninit/>
</arg>
Expand Down
24 changes: 22 additions & 2 deletions test/cfg/posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -913,8 +913,8 @@ typedef struct {
} S_memalign;

S_memalign* posix_memalign_memleak(size_t n) { // #12248
S_memalign* s = malloc(sizeof(*s));
s->N = n;
S_memalign* s = malloc(sizeof(*s));
s->N = n;
if (0 != posix_memalign((void**)&s->data, 16, n * sizeof(int))) {
free(s);
return NULL;
Expand Down Expand Up @@ -1079,6 +1079,26 @@ void memleak_getline_array(FILE* stream) { // #12498
free(a[1]);
}

void memleak_getdelim(int delim) {
char *line = NULL;
size_t size = 0;
getdelim(&line, &size, delim, stdin);
// cppcheck-suppress memleak
line = NULL;
getdelim(&line, &size, delim, stdin);
// cppcheck-suppress memleak
line = NULL;
}

void memleak_getdelim_array(FILE* stream, int delim) {
char* a[2] = { 0 };
size_t n;
getdelim(&a[0], &n, delim, stream);
getdelim(&a[1], &n, delim, stream);
free(a[0]);
free(a[1]);
}

void * identicalCondition_mmap(int fd, size_t size) // #9940
{
void* buffer = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
Expand Down