forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit6c20bdb
committed
Further tweak memory management for regex DFAs.
Coverity is still unhappy after commit190c798, and after lookingcloser I think it might be onto something. The callers of newdfa()typically drop out if v->err has been set nonzero, which newdfa()is faithfully doing if it fails. However, what if v->err was alreadynonzero before we entered newdfa()? Then newdfa() could succeed andthe caller would promptly leak its result.I don't think this scenario can actually happen, but the predicate"v->err is always zero when newdfa() is called" seems difficult to beentirely sure of; there's a good deal of code that potentially couldget that wrong.It seems better to adjust the callers to directly check for a nullresult instead of relying on ISERR() tests. This is slightly cheaperthan the previous coding anyway.Lacking evidence that there's any real bug, no back-patch.1 parent8a812e5 commit6c20bdb
2 files changed
+10
-10
lines changedLines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
604 | 604 |
| |
605 | 605 |
| |
606 | 606 |
| |
| 607 | + | |
| 608 | + | |
607 | 609 |
| |
608 | 610 |
| |
609 | 611 |
| |
|
Lines changed: 8 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
351 | 351 |
| |
352 | 352 |
| |
353 | 353 |
| |
354 |
| - | |
| 354 | + | |
355 | 355 |
| |
356 | 356 |
| |
357 | 357 |
| |
| |||
381 | 381 |
| |
382 | 382 |
| |
383 | 383 |
| |
384 |
| - | |
385 |
| - | |
386 | 384 |
| |
387 | 385 |
| |
388 | 386 |
| |
| |||
408 | 406 |
| |
409 | 407 |
| |
410 | 408 |
| |
411 |
| - | |
412 |
| - | |
| 409 | + | |
| 410 | + | |
413 | 411 |
| |
414 | 412 |
| |
415 | 413 |
| |
| |||
436 | 434 |
| |
437 | 435 |
| |
438 | 436 |
| |
439 |
| - | |
440 |
| - | |
| 437 | + | |
| 438 | + | |
441 | 439 |
| |
442 | 440 |
| |
443 | 441 |
| |
| |||
493 | 491 |
| |
494 | 492 |
| |
495 | 493 |
| |
496 |
| - | |
| 494 | + | |
| 495 | + | |
497 | 496 |
| |
498 |
| - | |
| 497 | + | |
499 | 498 |
| |
500 |
| - | |
501 | 499 |
| |
502 | 500 |
| |
503 | 501 |
| |
|
0 commit comments
Comments
(0)