Commit 11981f5
committed
Whenver a path search is done by default path (when PATH is unset
or not yet set, or when 'command -p' is used), defpathinit() is
called to obtain the default path. Each time, path_addpath() is
called to convert the path to the path.c path component structure.
This is a memory leak; it should only be done once.
src/cmd/ksh93/sh/path.c: defpathinit():
- Rename to defpath() as this is clearly not only called at init.
- Save the path_addpath() call result in a static variable.
- Only call path_addpath() on first use, otherwise return saved.
1 parent 970812e commit 11981f5
3 files changed
+17
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
406 | 406 | | |
407 | 407 | | |
408 | 408 | | |
409 | | - | |
| 409 | + | |
410 | 410 | | |
411 | | - | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
412 | 415 | | |
413 | 416 | | |
414 | 417 | | |
| |||
419 | 422 | | |
420 | 423 | | |
421 | 424 | | |
422 | | - | |
| 425 | + | |
423 | 426 | | |
424 | 427 | | |
425 | 428 | | |
| |||
441 | 444 | | |
442 | 445 | | |
443 | 446 | | |
444 | | - | |
| 447 | + | |
445 | 448 | | |
446 | 449 | | |
447 | 450 | | |
| |||
1619 | 1622 | | |
1620 | 1623 | | |
1621 | 1624 | | |
1622 | | - | |
| 1625 | + | |
1623 | 1626 | | |
1624 | 1627 | | |
1625 | 1628 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
356 | 356 | | |
357 | 357 | | |
358 | 358 | | |
359 | | - | |
| 359 | + | |
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
| |||
445 | 445 | | |
446 | 446 | | |
447 | 447 | | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
448 | 454 | | |
449 | 455 | | |
0 commit comments