-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Use lib_free for memory deallocation after strdup or asprintf #10110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This reverts commit 7884c18.
The memory allocated with strdup and asprintf is done via lib_malloc so we need to use lib_free to deallocate memory otherwise the assertion "Free memory from the wrong heap" is hit with flat mode and user separated heap enabled mode. Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
424ab43 to
f4934ca
Compare
|
I'll let our internal CI running and tomorrow morning I'll review the PR ;) |
f4934ca to
2fff68f
Compare
|
conflicting target on RISC, the rest that is just cascading. -> _off_t Error: chip/esp_libc_stubs.c:97:5: error: conflicting types for '_lseek_r'
[469](https://github.com/apache/nuttx/actions/runs/5791110743/job/15695470612?pr=10110#step:7:470)
97 | int _lseek_r(struct _reent *r, int fd, int offset, int whence)
[470](https://github.com/apache/nuttx/actions/runs/5791110743/job/15695470612?pr=10110#step:7:471)
| ^~~~~~~~
[471](https://github.com/apache/nuttx/actions/runs/5791110743/job/15695470612?pr=10110#step:7:472)
In file included from /github/workspace/sources/nuttx/arch/risc-v/src/chip/esp-hal-3rdparty/components/esp_rom/include/esp32c3/rom/libc_stubs.h:14,
[472](https://github.com/apache/nuttx/actions/runs/5791110743/job/15695470612?pr=10110#step:7:473)
from chip/esp_libc_stubs.c:41:
[473](https://github.com/apache/nuttx/actions/runs/5791110743/job/15695470612?pr=10110#step:7:474)
/tools/riscv64-unknown-elf-gcc/riscv64-unknown-elf/include/reent.h:148:15: note: previous declaration of '_lseek_r' was here
[474](https://github.com/apache/nuttx/actions/runs/5791110743/job/15695470612?pr=10110#step:7:475)
148 | extern _off_t _lseek_r (struct _reent *, int, _off_t, int); |
|
As far as I tested on ESP32, the build passed and the crash former seen has been fixed. |
2fff68f to
17ce5b9
Compare
ba56f0e to
9a6ebcb
Compare
|
Re-running our internal CI... |
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
9a6ebcb to
263f1b3
Compare
tmedicci
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our internal CI passed succesfully ;)
Summary
This PR contains next set of the changes:
lib_freefor memory de-allocation afterstrduporasprintfFARqualifier_SCHED_GETPIDingetpgrp()implementationImpact
Should fix assert "Free memory from the wrong heap" with flat mode and user separated heap enabled mode
Testing
Pass CI