Skip to content

Commit 1895279

Browse files
committed
Add missing memset to 0 in AO, FSM and PAL
1 parent 32acf17 commit 1895279

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

libs/ao/ao.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ void am_ao_unsubscribe_all(const struct am_ao *ao) {
234234

235235
void am_ao_ctor(struct am_ao *ao, struct am_hsm_state state) {
236236
AM_ASSERT(ao);
237+
memset(ao, 0, sizeof(*ao));
237238
am_hsm_ctor(&ao->hsm, state);
238239
}
239240

libs/fsm/fsm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
#include <stdbool.h>
3333
#include <stddef.h>
34+
#include <string.h>
3435

3536
#include "common/macros.h"
3637
#include "fsm/fsm.h"

libs/pal/posix/pal.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
#include <stdio.h>
4141
#include <stdint.h>
42+
#include <string.h>
4243

4344
#define _POSIX_C_SOURCE 200809L
4445

@@ -378,6 +379,8 @@ void am_pal_flush(void) { fflush(stdout); }
378379
void am_pal_ctor(void) {
379380
struct am_pal_task *task = &task_main_;
380381

382+
memset(task, 0, sizeof(*task));
383+
381384
task->thread = pthread_self();
382385
am_pal_mutex_init(&task->mutex);
383386

0 commit comments

Comments
 (0)