Skip to content

Commit 0072df6

Browse files
committed
Add missing critnib initialization
Critnib code assumed that all members are zeroed in critnib_new. This was not the case since we switched to using global base alloc.
1 parent 37fd114 commit 0072df6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/critnib/critnib.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#include <errno.h>
5757
#include <stdbool.h>
5858
#include <stddef.h>
59+
#include <string.h>
5960

6061
#include "base_alloc.h"
6162
#include "base_alloc_global.h"
@@ -186,6 +187,8 @@ struct critnib *critnib_new(void) {
186187
return NULL;
187188
}
188189

190+
memset(c, 0, sizeof(struct critnib));
191+
189192
void *mutex_ptr = util_mutex_init(&c->mutex);
190193
if (!mutex_ptr) {
191194
goto err_free_critnib;

0 commit comments

Comments
 (0)