- Notifications
You must be signed in to change notification settings - Fork5
Commit273986b
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 parentd9fad10 commit273986b
1 file changed
+40
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
364 | 365 | | |
365 | 366 | | |
366 | 367 | | |
| 368 | + | |
367 | 369 | | |
368 | 370 | | |
369 | 371 | | |
| |||
387 | 389 | | |
388 | 390 | | |
389 | 391 | | |
390 | | - | |
391 | | - | |
392 | 392 | | |
393 | 393 | | |
394 | | - | |
| 394 | + | |
395 | 395 | | |
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
400 | | - | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
401 | 410 | | |
402 | 411 | | |
403 | 412 | | |
| |||
416 | 425 | | |
417 | 426 | | |
418 | 427 | | |
419 | | - | |
| 428 | + | |
420 | 429 | | |
421 | 430 | | |
422 | 431 | | |
423 | 432 | | |
424 | 433 | | |
425 | | - | |
426 | | - | |
| 434 | + | |
| 435 | + | |
427 | 436 | | |
428 | 437 | | |
429 | | - | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
430 | 445 | | |
431 | 446 | | |
432 | 447 | | |
| |||
714 | 729 | | |
715 | 730 | | |
716 | 731 | | |
| 732 | + | |
717 | 733 | | |
718 | 734 | | |
719 | 735 | | |
| |||
734 | 750 | | |
735 | 751 | | |
736 | 752 | | |
737 | | - | |
738 | | - | |
739 | 753 | | |
740 | 754 | | |
741 | | - | |
| 755 | + | |
742 | 756 | | |
743 | 757 | | |
744 | 758 | | |
745 | 759 | | |
746 | 760 | | |
747 | | - | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
748 | 771 | | |
749 | 772 | | |
750 | 773 | | |
751 | 774 | | |
752 | 775 | | |
| 776 | + | |
753 | 777 | | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
754 | 782 | | |
755 | 783 | | |
756 | 784 | | |
| |||
0 commit comments
Comments
(0)