diff --git a/cfg/std.cfg b/cfg/std.cfg
index a655528c2..35dcb8796 100644
--- a/cfg/std.cfg
+++ b/cfg/std.cfg
@@ -7312,7 +7312,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
malloc
calloc
- aligned_alloc
+ aligned_alloc
free
diff --git a/test/cfg/std.c b/test/cfg/std.c
index dd7819ea3..db43495e8 100644
--- a/test/cfg/std.c
+++ b/test/cfg/std.c
@@ -75,6 +75,12 @@ void bufferAccessOutOfBounds(void)
fwrite(a,1,5,stdout);
// cppcheck-suppress bufferAccessOutOfBounds
fread(a,1,6,stdout);
+
+ char * pAlloc1 = aligned_alloc(8, 16);
+ memset(pAlloc1, 0, 16);
+ // cppcheck-suppress bufferAccessOutOfBounds
+ memset(pAlloc1, 0, 17);
+ free(pAlloc1);
}
void bufferAccessOutOfBounds_libraryDirectionConfiguration(void)
@@ -89,6 +95,15 @@ void bufferAccessOutOfBounds_libraryDirectionConfiguration(void)
arr[c] = 'x';
}
+void arrayIndexOutOfBounds()
+{
+ char * pAlloc1 = aligned_alloc(8, 16);
+ pAlloc1[15] = '\0';
+ // cppcheck-suppress arrayIndexOutOfBounds
+ pAlloc1[16] = '1';
+ free(pAlloc1);
+}
+
// memory leak
void ignoreleak(void)