forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit797ea52
committed
Fix memory leaks in record_out() and record_send().
record_out() leaks memory: it fails to free the strings returned by theper-column output functions, and also is careless about detoasted values.This results in a query-lifespan memory leakage when returning compositevalues to the client, because printtup() runs the output functions in thequery-lifespan memory context. Fix it to handle these issues the same wayprinttup() does. Also fix a similar leakage in record_send().(At some point we might want to try to run output functions inshorter-lived memory contexts, so that we don't need a zero-leakage policyfor them. But that would be a significantly more invasive patch, whichdoesn't seem like material for back-patching.)In passing, use appendStringInfoCharMacro instead of appendStringInfoCharin the innermost data-copying loop of record_out, to try to shave a fewcycles from this function's runtime.Per trouble report from Carlos Henrique Reimer. Back-patch to allsupported versions.1 parent759340c commit797ea52
1 file changed
+40
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
363 | 364 | | |
364 | 365 | | |
365 | 366 | | |
| 367 | + | |
366 | 368 | | |
367 | 369 | | |
368 | 370 | | |
| |||
386 | 388 | | |
387 | 389 | | |
388 | 390 | | |
389 | | - | |
390 | | - | |
391 | 391 | | |
392 | 392 | | |
393 | | - | |
| 393 | + | |
394 | 394 | | |
395 | 395 | | |
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
399 | | - | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
400 | 409 | | |
401 | 410 | | |
402 | 411 | | |
| |||
415 | 424 | | |
416 | 425 | | |
417 | 426 | | |
418 | | - | |
| 427 | + | |
419 | 428 | | |
420 | 429 | | |
421 | 430 | | |
422 | 431 | | |
423 | 432 | | |
424 | | - | |
425 | | - | |
| 433 | + | |
| 434 | + | |
426 | 435 | | |
427 | 436 | | |
428 | | - | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
429 | 444 | | |
430 | 445 | | |
431 | 446 | | |
| |||
713 | 728 | | |
714 | 729 | | |
715 | 730 | | |
| 731 | + | |
716 | 732 | | |
717 | 733 | | |
718 | 734 | | |
| |||
733 | 749 | | |
734 | 750 | | |
735 | 751 | | |
736 | | - | |
737 | | - | |
738 | 752 | | |
739 | 753 | | |
740 | | - | |
| 754 | + | |
741 | 755 | | |
742 | 756 | | |
743 | 757 | | |
744 | 758 | | |
745 | 759 | | |
746 | | - | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
747 | 770 | | |
748 | 771 | | |
749 | 772 | | |
750 | 773 | | |
751 | 774 | | |
| 775 | + | |
752 | 776 | | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
753 | 781 | | |
754 | 782 | | |
755 | 783 | | |
| |||
0 commit comments
Comments
(0)