1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-04 12:52:15 +00:00

libcasper: Neuter false positive -Wuse-after-free warnings from GCC 13

GCC 13 incorrectly thinks a call to free after a failed realloc is a
use after free.

lib/libcasper/services/cap_grp/cap_grp.c: In function 'group_resize':
lib/libcasper/services/cap_grp/cap_grp.c:65:17: error: pointer 'buf' may be used after 'realloc' [-Werror=use-after-free]
   65 |                 free(buf);
      |                 ^~~~~~~~~
lib/libcasper/services/cap_grp/cap_grp.c:63:19: note: call to 'realloc' here
   63 |         gbuffer = realloc(buf, gbufsize);
      |                   ^~~~~~~~~~~~~~~~~~~~~~

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D42576
This commit is contained in:
John Baldwin 2023-11-14 18:34:01 -08:00
parent b50261e21f
commit b7f7cc25c0
3 changed files with 9 additions and 0 deletions

View File

@ -40,3 +40,6 @@ MLINKS+=cap_grp.3 cap_grp_limit_fields.3
MLINKS+=cap_grp.3 cap_grp_limit_groups.3
.include <bsd.lib.mk>
# GCC 13 complains incorrectly about free after failed realloc: GCC bug #110501
CFLAGS.cap_grp.c+= ${NO_WUSE_AFTER_FREE}

View File

@ -29,3 +29,6 @@ MLINKS+=cap_netdb.3 libcap_netdb.3
MLINKS+=cap_netdb.3 cap_getprotobyname.3
.include <bsd.lib.mk>
# GCC 13 complains incorrectly about free after failed realloc: GCC bug #110501
CFLAGS.cap_netdb.c+= ${NO_WUSE_AFTER_FREE}

View File

@ -40,3 +40,6 @@ MLINKS+=cap_pwd.3 cap_pwd_limit_fields.3
MLINKS+=cap_pwd.3 cap_pwd_limit_users.3
.include <bsd.lib.mk>
# GCC 13 complains incorrectly about free after failed realloc: GCC bug #110501
CFLAGS.cap_pwd.c+= ${NO_WUSE_AFTER_FREE}