Skip to content

Commit 3bb3c9c

Browse files
committed
fix a memory leak in canopen_app_init
1 parent c7fb1de commit 3bb3c9c

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

CANopenNode_STM32/CO_app_STM32.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ canopen_app_init(CANopenNodeSTM32* _canopenNodeSTM32) {
6363
canopenNodeSTM32 = _canopenNodeSTM32;
6464

6565
#if (CO_CONFIG_STORAGE) & CO_CONFIG_STORAGE_ENABLE
66-
CO_storage_t storage;
67-
CO_storage_entry_t storageEntries[] = {{.addr = &OD_PERSIST_COMM,
68-
.len = sizeof(OD_PERSIST_COMM),
69-
.subIndexOD = 2,
70-
.attr = CO_storage_cmd | CO_storage_restore,
71-
.addrNV = NULL}};
66+
static CO_storage_t storage;
67+
static CO_storage_entry_t storageEntries[] = {{.addr = &OD_PERSIST_COMM,
68+
.len = sizeof(OD_PERSIST_COMM),
69+
.subIndexOD = 2,
70+
.attr = CO_storage_cmd | CO_storage_restore,
71+
.addrNV = NULL}};
7272
uint8_t storageEntriesCount = sizeof(storageEntries) / sizeof(storageEntries[0]);
7373
uint32_t storageInitError = 0;
7474
#endif

0 commit comments

Comments
 (0)