Skip to content

Commit 5a19377

Browse files
committed
Fix am_hsm_ctor() bug
1 parent ea82a2a commit 5a19377

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

libs/hsm/hsm.c

Lines changed: 2 additions & 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 "hsm/hsm.h"
@@ -332,6 +333,7 @@ struct am_hsm_state am_hsm_state(const struct am_hsm *hsm) {
332333
void am_hsm_ctor(struct am_hsm *hsm, struct am_hsm_state state) {
333334
AM_ASSERT(hsm);
334335
AM_ASSERT(state.fn);
336+
memset(hsm, 0, sizeof(*hsm));
335337
hsm_set_state(hsm, state);
336338
hsm->ctor_called = true;
337339
}

0 commit comments

Comments
 (0)