Skip to content

Commit 2a46979

Browse files
trofijwcart2
authored andcommitted
libsemanage: fix src/genhomedircon.c build on gcc-14 (-Werror=alloc-size)
`gcc-14` added a new `-Walloc-size` warning that makes sure that size of an individual element matches size of a pointed type: https://gcc.gnu.org/PR71219 `libsemanage` triggers it on `calloc()` calls where member size is used as `1` (instead of member count): genhomedircon.c: In function 'ignore_setup': genhomedircon.c:152:21: error: allocation of insufficient size '1' for type 'ignoredir_t' {aka 'struct IgnoreDir'} with size '16' [-Werror=alloc-size] 152 | ptr = calloc(sizeof(ignoredir_t),1); | ^ Signed-off-by: Sergei Trofimovich <slyich@gmail.com> Acked-by: James Carter <jwcart2@gmail.com>
1 parent 139afe5 commit 2a46979

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libsemanage/src/genhomedircon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ static int ignore_setup(char *ignoredirs) {
149149

150150
tok = strtok(ignoredirs, ";");
151151
while(tok) {
152-
ptr = calloc(sizeof(ignoredir_t),1);
152+
ptr = calloc(1, sizeof(ignoredir_t));
153153
if (!ptr)
154154
goto err;
155155
ptr->dir = strdup(tok);

0 commit comments

Comments
 (0)