pkg/lwip: fix memory issue when sending with empty sock#12927
pkg/lwip: fix memory issue when sending with empty sock#12927wosym wants to merge 1 commit intoRIOT-OS:masterfrom
Conversation
fe5d0ba to
e671b00
Compare
| return -ENOMEM; | ||
| } | ||
| if (conn == NULL) { | ||
| noconn = 1; |
There was a problem hiding this comment.
You could just move this assignment after line 524 and safe an extra check.
There was a problem hiding this comment.
Mhmmm, but that line does more than only checking of conn == NULL?
if (((conn == NULL) || (*conn == NULL)) && (remote != NULL))
Would you prefer to split this conditional up in multiple parts, and then place the noconn assignment inside the block?
There was a problem hiding this comment.
Let me have another holistic view on the code...
There was a problem hiding this comment.
I think the code needs a lot more clean-up... Let me open an alternative PR.
There was a problem hiding this comment.
See #12932. This code contained a lot of unnecessary second-level indirections.
|
#12932 was merged, so this can be closed. |
Contribution description
Memory-issue described in #12859 fixed by calling extra netconn_delete() on *tmp.
Testing procedure
in tests/lwip: udp send IP_HERE 123 ff 30 500
Before fix: +/- 20 successful sends, memory errors on all later sends
After fix: All sends are successful.
Behaviour has also been tested with ip send. Before fix: memory issues after n successful sends. After fix: infinite successful sends.
Issues/PRs references
Fixes #12859