Commit 6c20bdb
committed
Further tweak memory management for regex DFAs.
Coverity is still unhappy after commit 190c798, and after looking
closer 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 already
nonzero before we entered newdfa()? Then newdfa() could succeed and
the 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 be
entirely sure of; there's a good deal of code that potentially could
get that wrong.
It seems better to adjust the callers to directly check for a null
result instead of relying on ISERR() tests. This is slightly cheaper
than the previous coding anyway.
Lacking evidence that there's any real bug, no back-patch.1 parent 8a812e5 commit 6c20bdb
2 files changed
+10
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
604 | 604 | | |
605 | 605 | | |
606 | 606 | | |
| 607 | + | |
| 608 | + | |
607 | 609 | | |
608 | 610 | | |
609 | 611 | | |
| |||
| 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