Summary: | Calls to semctl() trigger "uninitialized memory" warning from valgrind | ||
---|---|---|---|
Product: | Apache httpd-2 | Reporter: | Mikhail T. <mi+apache> |
Component: | Core | Assignee: | Apache HTTPD Bugs Mailing List <bugs> |
Status: | NEW --- | ||
Severity: | normal | Keywords: | FixedInTrunk, PatchAvailable |
Priority: | P3 | ||
Version: | 2.4.2 | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | Linux |
Description
Mikhail T.
2012-08-09 22:51:05 UTC
with that I get unixd.c: In function ‘ap_unixd_set_proc_mutex_perms’: unixd.c:244:20: warning: missing braces around initializer [-Wmissing-braces] unixd.c:244:20: warning: (near initialization for ‘buf.sem_perm’) [-Wmissing-braces] (In reply to comment #1) > unixd.c: In function ‘ap_unixd_set_proc_mutex_perms’: > unixd.c:244:20: warning: missing braces around initializer [-Wmissing-braces] Yeah, the first field of the semid_ds-structure is also a structure (at least on Linux and FreeBSD), so using two layers of braces should work: struct semid_ds buf = {{ 0 }}; If that's not portable enough, then bzero() might be in order: bzero(&buf, sizeof(buf)); however annoying it might be to have a function-call (even if compiler will optimize it away) just to zero-out an automatic variable :-( |