mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 12:42:30 +04:00
Loader: Fix BusFault in handling of OOM (#3992)
* Loader: Fix BusFault in handling of OOM * Furi: fix crash in aligned_alloc, cleanup aligned_alloc use Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -106,5 +106,7 @@ void* aligned_malloc(size_t size, size_t alignment) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void aligned_free(void* p) {
|
void aligned_free(void* p) {
|
||||||
|
if(p) {
|
||||||
free(((void**)p)[-1]);
|
free(((void**)p)[-1]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -830,9 +830,7 @@ void elf_file_free(ELFFile* elf) {
|
|||||||
for(ELFSectionDict_it(it, elf->sections); !ELFSectionDict_end_p(it);
|
for(ELFSectionDict_it(it, elf->sections); !ELFSectionDict_end_p(it);
|
||||||
ELFSectionDict_next(it)) {
|
ELFSectionDict_next(it)) {
|
||||||
const ELFSectionDict_itref_t* itref = ELFSectionDict_cref(it);
|
const ELFSectionDict_itref_t* itref = ELFSectionDict_cref(it);
|
||||||
if(itref->value.data) {
|
|
||||||
aligned_free(itref->value.data);
|
aligned_free(itref->value.data);
|
||||||
}
|
|
||||||
if(itref->value.fast_rel) {
|
if(itref->value.fast_rel) {
|
||||||
aligned_free(itref->value.fast_rel->data);
|
aligned_free(itref->value.fast_rel->data);
|
||||||
free(itref->value.fast_rel);
|
free(itref->value.fast_rel);
|
||||||
|
|||||||
Reference in New Issue
Block a user