This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit d38078b778d539bd7e1db2170559888e4e09e08d
Author: fangxinyong <[email protected]>
AuthorDate: Sun Sep 14 14:13:42 2025 +0800

    libs/libc: posix_spawnattr_init zero-initialize attr
    
    Zero-initialize posix_spawnattr_t in posix_spawnattr_init().
    Prevent use of uninitialized fields reported by Coverity.
    Preserve existing default flag initialization.
    
    Signed-off-by: fangxinyong <[email protected]>
---
 libs/libc/spawn/lib_psa_init.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libs/libc/spawn/lib_psa_init.c b/libs/libc/spawn/lib_psa_init.c
index aaff5ea5a9e..20313348710 100644
--- a/libs/libc/spawn/lib_psa_init.c
+++ b/libs/libc/spawn/lib_psa_init.c
@@ -61,6 +61,8 @@ int posix_spawnattr_init(posix_spawnattr_t *attr)
 
   DEBUGASSERT(attr);
 
+  memset(attr, 0, sizeof(*attr));
+
   /* Flags: None */
 
   attr->flags = 0;

Reply via email to