Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
_fileName and _values have to be re-set to NULL, otherwise a double-free might occur.
First destroy() is called when the eeprom filesize does not match, the second destroy() is called from the dtor of SoftEeprom on exit:
Nov 11 17:00:01 INFO Starting gateway...
Nov 11 17:00:01 INFO Protocol version - 2.3.2-beta
Nov 11 17:00:01 ERROR EEPROM file /etc/mysensors.eeprom is not the correct size of 1024. Please remove the file and a new one will be created.
double free or corruption (!prev)
Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../sysdeps/unix/sysv/linux/raise.c: Datei oder Verzeichnis nicht gefunden.
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x76c6ed2c in __GI_abort () at abort.c:79
#2 0x76ca8cec in __libc_message (action=action@entry=do_abort, fmt=) at ../sysdeps/posix/libc_fatal.c:181
#3 0x76caf550 in malloc_printerr (str=) at malloc.c:5350
#4 0x76cb15ac in _int_free (av=0x76d8a7c4 <main_arena>, p=0x485d8, have_lock=) at malloc.c:4281
#5 0x0001931c in SoftEeprom::destroy (this=0x406f4 ) at hal/architecture/Linux/drivers/core/SoftEeprom.cpp:100
#6 SoftEeprom::~SoftEeprom (this=0x406f4 , __in_chrg=) at hal/architecture/Linux/drivers/core/SoftEeprom.cpp:46
#7 0x76c70424 in __run_exit_handlers (status=status@entry=1, listp=, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
#8 0x76c7054c in __GI_exit (status=status@entry=1) at exit.c:139
#9 0x00026840 in hwInit () at ./hal/architecture/Linux/MyHwLinuxGeneric.cpp:38
#10 _begin () at ./core/MySensorsCore.cpp:116
#11 0x00012f08 in main (argc=1, argv=0xc) at ./hal/architecture/Linux/MyMainLinuxGeneric.cpp:447
I would suggest changing the _fileName to a std::string and _values to a std::vector<uint8_t>. I would make the change, if you're ok with it?