Skip to content

Commit ac995b1

Browse files
authored
Merge pull request #40 from lvsoft/master
fix a memory leak in `canopen_app_init`
2 parents b2a47fa + 3bb3c9c commit ac995b1

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)