Am Mi., 12. Mai 2021 um 12:25 Uhr schrieb Ondrej Mosnacek <omosnace@xxxxxxxxxx>: > > Building libselinux with GCC 11.1.1 produces the following warning: > ``` > In file included from label_file.c:24: > In function ‘store_stem’, > inlined from ‘load_mmap’ at label_file.c:277:12, > inlined from ‘process_file’ at label_file.c:551:5: > label_file.h:289:25: error: ‘free’ called on pointer ‘*mmap_area.next_addr’ with nonzero offset 4 [-Werror=free-nonheap-object] > 289 | free(buf); > | ^~~~~~~~~ > ``` > > Indeed, in this case the pointer shouldn't be freed as it comes from > mmap. Fix this by adding a from_mmap parameter to store_stem() instead > of overriding the saved_data::from_mmap value in load_mmap(). > > Signed-off-by: Ondrej Mosnacek <omosnace@xxxxxxxxxx> See https://patchwork.kernel.org/project/selinux/patch/20210503175350.55954-17-cgzones@xxxxxxxxxxxxxx/ for an alternative.