Commit 100938b
committed
Fix file descriptor leak when proc_open() descriptor setup fails
When a descriptor spec entry fails to set up (unknown type, missing
mode) after an earlier entry already opened a pipe or socket,
proc_open() jumped to exit_fail without closing the descriptors it had
already opened, leaking those fds; repeated calls exhaust the process
descriptor table. Close the opened descriptors at exit_fail and drop
the now-redundant per-call close before each spawn-failure goto.
Closes phpGH-223111 parent 98563c2 commit 100938b
2 files changed
Lines changed: 23 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1371 | 1371 | | |
1372 | 1372 | | |
1373 | 1373 | | |
1374 | | - | |
1375 | 1374 | | |
1376 | 1375 | | |
1377 | 1376 | | |
| |||
1388 | 1387 | | |
1389 | 1388 | | |
1390 | 1389 | | |
1391 | | - | |
1392 | 1390 | | |
1393 | 1391 | | |
1394 | 1392 | | |
| |||
1408 | 1406 | | |
1409 | 1407 | | |
1410 | 1408 | | |
1411 | | - | |
1412 | 1409 | | |
1413 | 1410 | | |
1414 | 1411 | | |
| |||
1450 | 1447 | | |
1451 | 1448 | | |
1452 | 1449 | | |
1453 | | - | |
1454 | 1450 | | |
1455 | 1451 | | |
1456 | 1452 | | |
| |||
1540 | 1536 | | |
1541 | 1537 | | |
1542 | 1538 | | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
1543 | 1542 | | |
1544 | 1543 | | |
1545 | 1544 | | |
| |||
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
0 commit comments