Commit d25ae92
committed
mruby-socket: fix file descriptor leaks in accept2 and socketpair
Fixed critical resource leaks by pre-allocating mruby objects before system
calls. Since mrb_str_resize to smaller size and mrb_ary_push within
pre-allocated size cannot fail, moving allocations before socket creation
eliminates all leak potential with minimal code changes.
Co-authored-by: Atlassian Rovo Dev1 parent ea7ac6d commit d25ae92
1 file changed
Lines changed: 6 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
765 | 765 | | |
766 | 766 | | |
767 | 767 | | |
| 768 | + | |
| 769 | + | |
768 | 770 | | |
769 | 771 | | |
770 | 772 | | |
771 | 773 | | |
772 | | - | |
773 | | - | |
774 | 774 | | |
775 | | - | |
| 775 | + | |
776 | 776 | | |
777 | 777 | | |
778 | 778 | | |
| |||
868 | 868 | | |
869 | 869 | | |
870 | 870 | | |
| 871 | + | |
| 872 | + | |
871 | 873 | | |
872 | 874 | | |
873 | 875 | | |
874 | | - | |
875 | | - | |
| 876 | + | |
876 | 877 | | |
877 | 878 | | |
878 | 879 | | |
| |||
0 commit comments