diff --git a/fs/mqueue/mq_open.c b/fs/mqueue/mq_open.c index 683f94c1c0..9cf984a9a1 100644 --- a/fs/mqueue/mq_open.c +++ b/fs/mqueue/mq_open.c @@ -412,6 +412,8 @@ int file_mq_open(FAR struct file *mq, va_list ap; int ret; + memset(mq, 0, sizeof(*mq)); + va_start(ap, oflags); ret = file_mq_vopen(mq, mq_name, oflags, 0, ap, NULL); va_end(ap); diff --git a/fs/vfs/fs_open.c b/fs/vfs/fs_open.c index 6f5de6a1e9..8cf86b964d 100644 --- a/fs/vfs/fs_open.c +++ b/fs/vfs/fs_open.c @@ -366,6 +366,8 @@ int file_open(FAR struct file *filep, FAR const char *path, int oflags, ...) va_list ap; int ret; + memset(filep, 0, sizeof(*filep)); + va_start(ap, oflags); ret = file_vopen(filep, path, oflags, 0, ap); va_end(ap);