mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 10:46:31 +00:00
Berry fixed a rare condition when a GC causes a memory corruption (#18614)
This commit is contained in:
parent
c5e6115597
commit
4cd1136f4c
@ -23,6 +23,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Partition_Manager.tapp fixed
|
- Partition_Manager.tapp fixed
|
||||||
|
- Berry fixed a rare condition when a GC causes a memory corruption
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
@ -195,6 +195,9 @@ static bstring* newshortstr(bvm *vm, const char *str, size_t len)
|
|||||||
}
|
}
|
||||||
s = createstrobj(vm, len, 0);
|
s = createstrobj(vm, len, 0);
|
||||||
if (s) {
|
if (s) {
|
||||||
|
/* recompute size and list that may have changed due to a GC */
|
||||||
|
size = vm->strtab.size;
|
||||||
|
list = vm->strtab.table + (hash & (size - 1));
|
||||||
memcpy(cast(char *, sstr(s)), str, len);
|
memcpy(cast(char *, sstr(s)), str, len);
|
||||||
s->extra = 0;
|
s->extra = 0;
|
||||||
s->next = cast(void*, *list);
|
s->next = cast(void*, *list);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user